高分悬赏,c语言高手请进

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了高分悬赏,c语言高手请进相关的知识,希望对你有一定的参考价值。

用c语言编写软件完成以下任务,假设有十门课程,每门课程有:课程编号,课程名称,学分,学时。为自己设计一个选修课程系统,并将自己选课的信息保存到自己所见的文件myfile.txt中,注意:确保总学分不少于8分。要求:用户界面中的菜单至少应包括“读取数据”,“输入选课信息”,“查看已选情况”,“退出”四项。

#include<stdio.h> /*引用库函数*/
#include<stdlib.h>
#include<ctype.h>
#include<string.h>
typedef struct /*定义结构体数组*/

char num[10]; /*学号*/
char name[20]; /*姓名*/
int score; /*成绩*/
Student;
Student stu[80]; /*结构体数组变量*/
int menu_select() /*菜单函数*/

char c;
do
system("cls"); /*运行前清屏*/
printf("\\t\\t****Students\' Grade Management System****\\n"); /*菜单选择*/
printf("\\t\\t | 1. Input Records |\\n");
printf("\\t\\t | 2. Display All Records |\\n");
printf("\\t\\t | 3. Sort |\\n");
printf("\\t\\t | 4. Insert a Record |\\n");
printf("\\t\\t | 5. Delete a Record |\\n");
printf("\\t\\t | 6. Query |\\n");
printf("\\t\\t | 7. Statistic |\\n");
printf("\\t\\t | 8. Add Records from a Text File|\\n");
printf("\\t\\t | 9. Write to a Text file |\\n");
printf("\\t\\t | 0. Quit |\\n");
printf("\\t\\t*****************************************\\n");
printf("\\t\\t\\tGive your Choice(0-9):");
c=getchar(); /*读入选择*/
while(c<\'0\'||c>\'9\');
return(c-\'0\'); /*返回选择*/

int Input(Student stud[],int n) /*输入若干条记录*/
int i=0;
char sign,x[10]; /*x[10]为清除多余的数据所用*/
while(sign!=\'n\'&&sign!=\'N\') /*判断*/
printf("\\t\\t\\tstudent\'s num:"); /*交互输入*/
scanf("\\t\\t\\t%s",stud[n+i].num);
printf("\\t\\t\\tstudent\'s name:");
scanf("\\t\\t\\t%s",stud[n+i].name);
printf("\\t\\t\\tstudent\'s score:");
scanf("\\t\\t\\t%d",&stud[n+i].score);
gets(x); /*清除多余的输入*/
printf("\\t\\t\\tany more records?(Y/N)");
scanf("\\t\\t\\t%c",&sign); /*输入判断*/
i++;

return(n+i);

void Display(Student stud[],int n) /*显示所有记录*/

int i;
printf("\\t\\t\\t-----------------------------------\\n"); /*格式头*/
printf("\\t\\t\\tnumber name score\\n");
printf("\\t\\t\\t-----------------------------------\\n");
for(i=1;i<n+1;i++) /*循环输入*/

printf("\\t\\t\\t%-16s%-15s%d\\n",stud[i-1].num,stud[i-1].name,stud[i-1].score);
if(i>1&&i%10==0) /*每十个暂停*/
printf("\\t\\t\\t-----------------------------------\\n"); /*格式*/
printf("\\t\\t\\t");
system("pause");
printf("\\t\\t\\t-----------------------------------\\n");


printf("\\t\\t\\t");
system("pause");

void Sort_by_num(Student stud[],int n) /*按学号排序*/
int i,j,*p,*q,s;
char t[10];
for(i=0;i<n-1;i++) /*冒泡法排序*/
for(j=0;j<n-1-i;j++)
if(strcmp(stud[j].num,stud[j+1].num)>0)
strcpy(t,stud[j+1].num);
strcpy(stud[j+1].num,stud[j].num);
strcpy(stud[j].num,t);
strcpy(t,stud[j+1].name);
strcpy(stud[j+1].name,stud[j].name);
strcpy(stud[j].name,t);
p=&stud[j+1].score;
q=&stud[j].score;
s=*p;
*p=*q;
*q=s;


int Insert_a_record(Student stud[],int n) /*插入一条记录*/
char x[10]; /*清除多余输入所用*/
printf("\\t\\t\\tstudent\'s num:"); /*交互式输入*/
scanf("\\t\\t\\t%s",stud[n].num);
printf("\\t\\t\\tstudent\'s name:");
scanf("\\t\\t\\t%s",stud[n].name);
printf("\\t\\t\\tstudent\'s score:");
scanf("\\t\\t\\t%d",&stud[n].score);
gets(x);
n++;
Sort_by_num(stud,n); /*调用排序函数*/
printf("\\t\\t\\tInsert Successed!\\n"); /*返回成功信息*/
return(n);

int Delete_a_record(Student stud[],int n) /*按姓名查找,删除一条记录*/
char s[20];
int i=0,j;
printf("\\t\\t\\ttell me his(her) name:"); /*交互式问寻*/
scanf("%s",s);
while(strcmp(stud[i].name,s)!=0&&i<n) i++; /*查找判断*/
if(i==n)
printf("\\t\\t\\tnot find!\\n"); /*返回失败信息*/
return(n);

for(j=i;j<n-1;j++) /*删除操作*/

strcpy(stud[j].num,stud[j+1].num);
strcpy(stud[j].name,stud[j+1].name);
stud[j].score=stud[j+1].score;

printf("\\t\\t\\tDelete Successed!\\n"); /*返回成功信息*/
return(n-1);

void Query_a_record(Student stud[],int n) /*查找并显示一个记录*/
char s[20];
int i=0;
printf("\\t\\t\\tinput his(her) name:"); /*交互式输入*/
scanf("\\t\\t\\t%s",s);
while(strcmp(stud[i].name,s)!=0&&i<n) i++; /*查找判断*/
if(i==n)
printf("\\t\\t\\tnot find!\\n"); /*输入失败信息*/
return;


printf("\\t\\t\\this(her) number:%s\\n",stud[i].num); /*输出该学生信息*/
printf("\\t\\t\\this(her) score:%d\\n",stud[i].score);

void Statistic(Student stud[],int n) /*新增功能,输出统计信息*/
int i,j=0,k=0,sum=0;
float aver; /*成绩平均值*/
for(i=0;i<n;i++) /*循环输入判断*/

sum+=stud[i].score;
if(stud[j].score>stud[i].score) j=i;
if(stud[k].score<stud[i].score) k=i;

aver=1.0*sum/n;
printf("\\t\\t\\tthere are %d records.\\n",n); /*总共记录数*/
printf("\\t\\t\\tthe hignest score:\\n"); /*最高分*/
printf("\\t\\t\\tnumber:%s name:%s score:%d\\n",stud[j].num,stud[j].name,stud[j].score);
printf("\\t\\t\\tthe lowest score:\\n"); /*最低分*/
printf("\\t\\t\\tnumber:%s name:%s score:%d\\n",stud[k].num,stud[k].name,stud[k].score);
printf("\\t\\t\\tthe average score is %5.2f\\n",aver); /*平均分*/

int AddfromText(Student stud[],int n) /*从文件中读入数据*/
int i=0,num;
FILE *fp; /*定义文件指针*/
char filename[20]; /*定义文件名*/
printf("\\t\\t\\tInput the filename:");
scanf("\\t\\t\\t%s",filename); /*输入文件名*/
if((fp=fopen(filename,"rb"))==NULL) /*打开文件*/
printf("\\t\\t\\tcann\'t open the file\\n"); /*打开失败信息*/
printf("\\t\\t\\t");
system("pause");
return(n);

fscanf(fp,"%d",&num); /*读入总记录量*/
while(i<num) /*循环读入数据*/

fscanf(fp,"%s%s%d",stud[n+i].num,stud[n+i].name,&stud[n+i].score);
i++;

n+=num;
fclose(fp); /*关闭文件*/
printf("\\t\\t\\tSuccessed!\\n");
printf("\\t\\t\\t");
system("pause");
return(n);

void WritetoText(Student stud[],int n) /*将所有记录写入文件*/

int i=0;
FILE *fp; /*定义文件指针*/
char filename[20]; /*定义文件名*/
printf("\\t\\t\\tWrite Records to a Text File\\n"); /*输入文件名*/
printf("\\t\\t\\tInput the filename:");
scanf("\\t\\t\\t%s",filename);
if((fp=fopen(filename,"w"))==NULL) /*打开文件*/

printf("\\t\\t\\tcann\'t open the file\\n");
system("pause");
return;

fprintf(fp,"%d\\n",n); /*循环写入数据*/
while(i<n)

fprintf(fp,"%-16s%-15s%d\\n",stud[i].num,stud[i].name,stud[i].score);
i++;

fclose(fp); /*关闭文件*/
printf("Successed!\\n"); /*返回成功信息*/

void main() /*主函数*/

int n=0;
for(;;)

switch(menu_select()) /*选择判断*/

case 1:
printf("\\t\\t\\tInput Records\\n"); /*输入若干条记录*/
n=Input(stu,n);
break;
case 2:
printf("\\t\\t\\tDisplay All Records\\n"); /*显示所有记录*/
Display(stu,n);
break;
case 3:
printf("\\t\\t\\tSort\\n");
Sort_by_num(stu,n); /*按学号排序*/
printf("\\t\\t\\tSort Suceessed!\\n");
printf("\\t\\t\\t");
system("pause");
break;
case 4:
printf("\\t\\t\\tInsert a Record\\n");
n=Insert_a_record(stu,n); /*插入一条记录*/
printf("\\t\\t\\t");
system("pause");
break;
case 5:
printf("\\t\\t\\tDelete a Record\\n");
n=Delete_a_record(stu,n); /*按姓名查找,删除一条记录*/
printf("\\t\\t\\t");
system("pause");
break;
case 6:
printf("\\t\\t\\tQuery\\n");
Query_a_record(stu,n); /*查找并显示一个记录*/
printf("\\t\\t\\t");
system("pause");
break;
case 7:
printf("\\t\\t\\tStatistic\\n");
Statistic(stu,n); /*新增功能,输出统计信息*/
printf("\\t\\t\\t");
system("pause");
break;
case 8:
printf("\\t\\t\\tAdd Records from a Text File\\n");
n=AddfromText(stu,n); /*新增功能,输出统计信息*/
break;
case 9:
printf("\\t\\t\\tWrite to a Text file\\n");
WritetoText(stu,n); /*循环写入数据*/
printf("\\t\\t\\t");
system("pause");
break;
case 0:
printf("\\t\\t\\tHave a Good Luck,Bye-bye!\\n"); /*结束程序*/
printf("\\t\\t\\t");
system("pause");
exit(0);


参考技术A 我下学期也要学c语言了~~
所以现在还不会~~
加油加油
参考技术B 关注 参考技术C 这是一个比较复杂的系统了,分太少了,懒得做了,大概思路是:
课程是一个结构体变量,读取数据就是打开myfile.txt,输入信息,就是将键入的内容导入myfile.txt,查看已选信息我觉得跟第一个差不多吧~~~

C语言高手请进!!!

大学1年级C语言程序实践题:
一.学生管理系统,要求将学生的学号.姓名.性别.成绩以二叉树或动态链表存放在studio,txt文件中.通过以下拉菜单完成以下功能:
1.插入学生成绩
2.一定条件修改某些学生成绩
3.一定条件删除某些学生成绩
4.条件查询和模糊查询
5.将学生消息按成绩降序排列 放在studio,txt文件中
6.按不同分数段统计学生数,以饼图显现
二.扑克牌排序
从54张中选10张,背面朝上,然后逐一掀开,按数字大小排列.
数字相同时:黑桃>红桃>梅花>方片
用气泡法或选择法排序,并且动态显示排序过程
三.图书馆管理系统,要求实现用户(师生)与图书的基本消息管理与借还操作
我自己已经写出程序来了,并且已经交了(就是有点太复杂不实用),但是我想知道什么是更好最好的答案

#include<iostream>
#include<fstream>
#include<string>
#include <iomanip>
#include<windows.h>
#include<ctime>
using namespace std;

const int NAME_NUM=30;

struct student

char name[NAME_NUM];
float num;
float chinaNum;
float englishNum;
float mathNum;
float average;
float result;
int pos;
student *next;
;

void Print(student *head);
void InsertFront(student* &head, student *pNew);
void InsertRear(student* &head, student *pNew);
student* Find(student *head, char *findStr, char type);
student* Read();
void Write(student* head);
void ShowList(student* head);
int GetLength(student* head);
void Delete(student* &head, char *delStr,int delNum);
void FindMaxOrMin(student *head,char type,char maxOrMin);
void Reword(student *pStd);
void Sort(student *&head, char type,char maxOrMin);
void Count(student *&head);
void DeleteAll(student *&head);
bool Enter(char type);
void SetTitle(bool isLoad);
void AboutMe();
void ChaXun(string str,student *head);
void PaiMing(string str, student* head);
void ShanChu(string str, student *&head);
void XianShi(string str, student *head);
void XuiGai(string str, student *&head);
void ZengJia(string str, student* &head);
int Run();

bool Enter(char type)

ofstream out("Password.pwd",ios::app);
ifstream in("Password.pwd");

string s[2];
int num=0;

string zhangHao;
string miMa;
while(!in.eof())

in>>s[num];
num++;
if(num==2)

break;


if(s[0].compare("")==0 || type=='2' )


if(s[0].compare("")==0 && type!='2')

cout<<"你是第一次使用本程序,请设置帐号和密码."<<endl;

else

bool isLoad=false;
isLoad=Enter('1');
if(isLoad==true)

cout<<"修改用户."<<endl;
out.close();
out.open("Password.pwd",ios::trunc);

else

cout<<"你输入的密码错误."<<endl;
cout<<"你不是管理员不能修改密码."<<endl;
return false;


cout<<"请输入您的新帐号: ";
cin>>s[0];
cout<<"请输入您的新密码: ";
cin>>s[1];

string s1,s2;
for(int i=0; i<s[0].size(); i++)

s1+=char(int(s[0][i])+11);


for( i=0; i<s[1].size(); i++)

s2+=char(int(s[1][i])+11);

s[0]=s1;
s[1]=s2;
for( i=0; i<=1; i++)

out<<s[i]<<" ";

out.close();


string s1,s2;

for(int i=0; i<s[0].size(); i++)

s1+=char(int(s[0][i])-11);


for( i=0; i<s[1].size(); i++)

s2+=char(int(s[1][i])-11);


cout<<"请输入您的帐号: ";
cin>>zhangHao;
cout<<"请输入您的密码: ";
cin>>miMa;

if(zhangHao.compare(s1)==0 && miMa.compare(s2)==0)

return true;

else

return false;

return false;


void Print(student *head)

student *pHead=head;
int num=strlen(head->name);
while(head)

if(num<strlen(head->name))

num=strlen(head->name);

head=head->next;

head=pHead;
cout<<setw(num)<<head->name<<setw(8)
<<head->num<<setw(10)<<head->chinaNum
<<setw(10)<<head->mathNum<<setw(10)
<<head->englishNum<<setw(8)<<head->result
<<setw(8)<<head->average<<setw(5)<<head->pos<<endl;


void ShowList(student* head)


cout<<"姓名:"<<setw(8)<<"座号:"<<setw(10)
<<"语文分数:"<<setw(10) <<"数学分数:"
<<setw(10)<<"英语分数:"<<setw(8)<<"总分数:"
<<setw(8)<<"平均分:"<<setw(6)<<"名次:"<<endl<<endl;
while(head)


Count(head);

Print(head);

head=head->next;

cout<<endl;


void Write(student* head)

ofstream out("Student.dat",ios::trunc);

while(head)


Count(head);

out.write((char*)head,sizeof(student));
head=head->next;

out.close();


student* Read()

ifstream in("Student.dat");
student *head;
student *pP;
student *pEnd;
pP=new student;

pEnd=head=pP;

student *pS=new student;
memset(pS->name,0,NAME_NUM);
in.read((char*)pS,sizeof(student));

if(strcmp(pS->name,"\0")==0)

return NULL;


strcpy(pP->name,pS->name);
pP->num=pS->num;
pP->chinaNum=pS->chinaNum;
pP->englishNum=pS->englishNum;
pP->mathNum=pS->mathNum;

while(!in.eof())

in.read((char*)pS,sizeof(student));
pEnd->next=pP;
pEnd=pP;
pP=new student;

strcpy(pP->name,pS->name);
pP->num=pS->num;
pP->chinaNum=pS->chinaNum;
pP->englishNum=pS->englishNum;
pP->mathNum=pS->mathNum;



pEnd->next=NULL;
delete pP;
return head;


student* Find(student *head,char *findStr, char type)

/*参数说明:
type=='1' 按 名字 查找
type=='2' 按 座号 查找
type=='3' 按 语文 查找
type=='4' 按 数学 查找
type=='5' 按 英语 查找
type=='6' 按 总分 查找
type=='7' 按 平均分 查找
type=='8' 按 排名 查找 //没有实现
*/
bool isFind=false;
student *firstStd=NULL;

cout<<"姓名:"<<setw(8)<<"座号:"<<setw(10)
<<"语文分数:"<<setw(10) <<"数学分数:"
<<setw(10)<<"英语分数:"<<setw(8)<<"总分数:"
<<setw(8)<<"平均分:"<<setw(5)<<"名次:"<<endl<<endl;

while(head)

if(type=='1')

if(strcmp(head->name,findStr)==0)

if(firstStd==NULL)

firstStd=head;

Print(head);

isFind=true;
if(head->next==NULL)

return firstStd;



else if(type=='2')

if(int(head->num)==int(atof(findStr)))

if(firstStd==NULL)

firstStd=head;

Print(head);

isFind=true;
if(head->next==NULL)

return firstStd;



else if(type=='3')

if(int(head->chinaNum)==int(atof(findStr)))

if(firstStd==NULL)

firstStd=head;

Print(head);

isFind=true;
if(head->next==NULL)

return firstStd;



else if(type=='4')

if(int(head->mathNum)==int(atof(findStr)))

if(firstStd==NULL)

firstStd=head;

Print(head);

isFind=true;
if(head->next==NULL)

return firstStd;



else if(type=='5')

if(int(head->englishNum)==int(atof(findStr)))

if(firstStd==NULL)

firstStd=head;

Print(head);

isFind=true;
if(head->next==NULL)

return firstStd;




else if(type=='6')

if(int(head->result)==int(atof(findStr)))

if(firstStd==NULL)

firstStd=head;

Print(head);

isFind=true;
if(head->next==NULL)

return firstStd;



else if(type=='7')

if(int(head->average)==int(atof(findStr)))

if(firstStd==NULL)

firstStd=head;

Print(head);

isFind=true;
if(head->next==NULL)

return firstStd;




else if(type=='8')

if(int(head->pos)==int(atof(findStr)))

if(firstStd==NULL)

firstStd=head;

Print(head);

isFind=true;
if(head->next==NULL)

return firstStd;



head=head->next;

if(isFind==false)

cout<<"找不到你要找的记录."<<endl;
return NULL;

return firstStd;


void InsertRear(student* &head,student *pNew)

student *pEnd,*pHead,*pS=new student;

if(head==NULL)

InsertFront(head,pNew);
return ;

pHead=head;
while(head)

pEnd=head;
if(head->next==NULL)

break;


head=head->next;


strcpy(pS->name,pNew->name);
pS->num=pNew->num;
pS->chinaNum=pNew->chinaNum;
pS->englishNum=pNew->englishNum;
pS->mathNum=pNew->mathNum;
pS->next=NULL;

pEnd->next=pS;
head=pHead;



void InsertFront(student* &head, student *pNew)

student *pHead=new student;
strcpy(pHead->name,pNew->name);
pHead->num=pNew->num;
pHead->chinaNum=pNew->chinaNum;
pHead->englishNum=pNew->englishNum;
pHead->mathNum=pNew->mathNum;
pHead->next=head;
head=pHead;


int GetLength(student *head)

int len=0;
while(head)

len++;
head=head->next;

return len;


void Delete(student* &head, char *delStr,int delNum)

student* pDel,*pNew,*pHead;
bool isFind=false;

pHead=head;
if(strcmp(head->name,delStr)==0)

pNew=head->next;
delete head;
head=pNew;
if(delNum==2)

cout<<endl<<"因为要删除的记录在前面,所有只删除第一记录."<<endl;

return ;


while(head->next)

if(delNum==2)

if(strcmp(head->next->name,delStr)==0)

pNew=head->next->next;
pDel=head->next;
delete pDel;
head->next=pNew;
head=pHead;
isFind=true;



else

if(strcmp(head->next->name,delStr)==0)

pNew=head->next->next;
pDel=head->next;
delete pDel;
head->next=pNew;
head=pHead;
return ;


head=head->next;

head=pHead;

if(isFind==false)

cout<<"找不到你要删除的记录."<<endl;

else

cout<<"删除记录成功."<<endl;



void FindMaxOrMin(student *head,char type,char maxOrMin)

/*参数说明:
type=='1' 按 语文 查找
type=='2' 按 数学 查找
type=='3' 按 英语 查找
type=='4' 按 总分 查找
type=='5' 按 平均分 查找
type=='6' 按 排名 查找
*/

int maxNum;
student *pHead=head;
if(type=='1')

maxNum=int(head->chinaNum);

else if (type=='2')

maxNum=int(head->mathNum);

else if (type=='3')

maxNum=int(head->englishNum);

else if (type=='4')

maxNum=int(head->result);


else if (type=='5')

maxNum=int(head->average);


else if (type=='6')

maxNum=head->pos;

else

cout<<"你输入错误,请重新输入."<<endl;
return ;


while(head)

if(maxOrMin=='1')

if(type=='1')


if(maxNum<int(head->chinaNum))

maxNum=int(head->chinaNum);


else if (type=='2')

if(maxNum<int(head->mathNum))

maxNum=int(head->mathNum);


else if (type=='3')


if(maxNum<int(head->englishNum))

maxNum=int(head->englishNum);


else if (type=='4')

if(maxNum<int(head->result))

maxNum=int(head->result);


else if (type=='5')

if(maxNum<int(head->average))

maxNum=int(head->average);


else if (type=='6')

if(maxNum<head->pos)

maxNum=head->pos;



else

if(type=='1')


if(maxNum>int(head->chinaNum))

maxNum=int(head->chinaNum);


else if (type=='2')

if(maxNum>int(head->mathNum))

maxNum=int(head->mathNum);


else if (type=='3')


if(maxNum>int(head->englishNum))

maxNum=int(head->englishNum);


else if (type=='4')

if(maxNum>int(head->result))

maxNum=int(head->result);


else if (type=='5')

if(maxNum>int(head->average))

maxNum=int(head->average);


else if (type=='6')

if(maxNum>head->pos)

maxNum=head->pos;



head=head->next;


head=pHead;

cout<<"姓名:"<<setw(8)<<"座号:"<<setw(10)
<<"语文分数:"<<setw(10) <<"数学分数:"
<<setw(10)<<"英语分数:"<<setw(8)<<"总分数:"
<<setw(8)<<"平均分:"<<setw(5)<<"名次:"<<endl<<endl;

while(head)

if(type=='1')

if(int(head->chinaNum)==maxNum)

Print(head);


else if (type=='2')

if(int(head->mathNum)==maxNum)

Print(head);


else if (type=='3')

if(int(head->englishNum)==maxNum)

Print(head);


else if (type=='4')

if(int(head->result)==maxNum)

Print(head);


else if (type=='5')

if(int(head->average)==maxNum)

Print(head);


else if (type=='6')

if(head->pos==maxNum)

Print(head);



head=head->next;




void Reword(student *pStd)


if(pStd!=NULL)

cout<<"请输入学生的新名字:"<<endl;
cin>>pStd->name;
cout<<"请输入学生的座号"<<endl;
cin>>pStd->num;
cout<<"请输入学生的语文分数"<<endl;
cin>>pStd->chinaNum;
cout<<"请输入学生的数学分数"<<endl;
cin>>pStd->mathNum;
cout<<"请输入学生的英语分数"<<endl;
cin>>pStd->englishNum;

else

return ;



void Sort(student *&head, char type,char maxOrMin)

/*参数说明:
type=='1' 按 语文 排列
type=='2' 按 数学 排列
type=='3' 按 英语 排列
type=='4' 按 总分 排列
type=='5' 按 平均分 排列
type=='6' 按 座号 排列
*/
student *pHead,*pH;
pHead=pH=head;
int len=GetLength(head);
float *array=new float[len];
int i;
int x=0;

float num=0;

while(head)

Count(head);
if(type=='1')

num=head->chinaNum;

else if(type=='2')

num=head->mathNum;

else if(type=='3')

num=head->englishNum;

else if(type=='4')

num=head->result;

else if(type=='5')


num=head->average;

else if(type=='6')

num=head->num;

array[x]=num;
x++;
head=head->next;


head=pHead;
if(maxOrMin=='1')

for( i=1; i<len; i++)

for(int j=0; j<len-i; j++)

if(array[j]<array[j+1])

float num;
num=array[j];
array[j]=array[j+1];
array[j+1]=num;




else

for( i=1; i<len; i++)

for(int j=0; j<len-i; j++)

if(array[j]>array[j+1])

float num;
num=array[j];
array[j]=array[j+1];
array[j+1]=num;





int pos=1;

for(i=0; i<len; i++)

head=pHead;
while(head)

if(type=='1')

num=head->chinaNum;

else if(type=='2')

num=head->mathNum;

else if(type=='3')

num=head->englishNum;

else if(type=='4')

num=int(head->result);

else if(type=='5')

num=int(head->average);

else if(type=='6')

num=int(head->num);


int n=0;
if(int(array[i])==int(num))


if(int(array[i])!=int(array[i+1]))

if(n==0)

n=pos;

head->pos=pos;
pos++;

else


head->pos=n;


head=head->next;


head=pH;
delete []array;


void Count(student *&head)

head->result=head->chinaNum+head->englishNum+head->mathNum;
head->average=head->result/3;


void DeleteAll(student* &head)

student *cp,*np;

cp=head;
while(cp)

np=cp->next;
delete cp;
cp=np;

head=NULL;


void ChaXun(string str,student *head)

Sort(head,'4','1');
cout<<"欢迎使用查询功能"<<endl<<endl;
cout<<"请输入你要按什么查询 1->一般查询 2->查找最多 3->查找最少"<<endl;
string s;
cin>>s;
while(s[0]!='1'&&s[0]!='2'&&s[0]!='3')

cout<<"你输入错误,请重新输入."<<endl;
cin>>s;


if(s[0]=='1')

cout<<"按什么查询?"<<endl;
cout<<"1->姓名 2->座号 3->语文成绩 4->数学成绩 "
<<"5->英语成绩 6->总分 7->平均分 8->排名"<<endl;
cin>>str;

while(str[0]!='1' && str[0]!='2' &&
str[0]!='3' && str[0]!='4' &&
str[0]!='5' && str[0]!='6' &&
str[0]!='7' && str[0]!='8' )

cout<<"你输入错误,请重新输入."<<endl;
cin>>str;

char findStr[30];
cout<<"请输入要查找的关键字或关键数:"<<endl;
cin>>findStr;
switch(str[0])


case '1':
Find(head,findStr,'1');
break;
case '2':
Find(head,findStr,'2');
break;
case '3':
Find(head,findStr,'3');
break;
case '4':
Find(head,findStr,'4');
break;
case '5':
Find(head,findStr,'5');
break;
case '6':
Find(head,findStr,'6');
break;
case '7':
Find(head,findStr,'7');
break;
case '8':
Find(head,findStr,'8');
break;


else if(s[0]=='2')

cout<<"请输入要按什么查询?"<<endl;
cout<<"1->语文成绩 2->数学成绩 "
<<"3->英语成绩 4->总分 5->平均分 6->排名"<<endl;
string s;
cin>>s;
switch(s[0])

case '1':
FindMaxOrMin(head,'1','1');
break;
case '2':
FindMaxOrMin(head,'2','1');
break;
case '3':
FindMaxOrMin(head,'3','1');
break;
case '6':
FindMaxOrMin(head,'6','1');
break;
case '5':
FindMaxOrMin(head,'5','1');
break;
default:
FindMaxOrMin(head,'4','1');
break;


else if(s[0]=='3')

cout<<"请输入要按什么查询?"<<endl;
cout<<"1->语文成绩 2->数学成绩 "
<<"3->英语成绩 4->总分 5->平均分 6->排名"<<endl;
string s;
cin>>s;
switch(s[0])

case '1':
FindMaxOrMin(head,'1','2');
break;
case '2':
FindMaxOrMin(head,'2','2');
break;
case '3':
FindMaxOrMin(head,'3','2');
break;
case '6':
FindMaxOrMin(head,'6','2');
break;
case '5':
FindMaxOrMin(head,'5','2');
break;
default:
FindMaxOrMin(head,'4','2');
break;



void ZengJia(string str, student* &head)

student *pNew=new student;
cout<<"欢迎使用增加功能"<<endl<<endl;
cout<<"请输入新学生的名字 :"<<endl;
cin>>pNew->name;
cout<<"请输入新学生的座号 :"<<endl;
cin>>pNew->num;
cout<<"请输入他的语文分数 :"<<endl;
cin>>pNew->chinaNum;
cout<<"请输入他的数学分数"<<endl;
cin>>pNew->mathNum;
cout<<"请输入他的英语分数"<<endl;
cin>>pNew->englishNum;

cout<<"插入记录的 (1->最前面 2->最后面)"<<endl;
cin>>str;
while(str[0]!='1' && str[0]!='2')

cout<<"你输入错误,请重新输入."<<endl;
cout<<"插入记录的 (1->最前面 2->最后面)"<<endl;
cin>>str;

if(str[0]=='1')

InsertFront(head,pNew);

else if(str[0]=='2')

InsertRear(head,pNew);

cout<<"新学生增加成功."<<endl;



void ShanChu(string str, student *&head)

char delStr[30];
cout<<"欢迎使用删除功能"<<endl<<endl;
cout<<"1->查询删除 2->全部删除"<<endl;
cin>>str;
while(str[0]!='1' && str[0]!='2')

cout<<"输入错误,请重新输入."<<endl;
cin>>str;

if(str[0]=='1')

cout<<"请输入要删除的关键字"<<endl;
cin>>delStr;
cout<<"1->删除第一条找到的记录 2->删除所有找到的记录"<<endl;
cin>>str;
while(str[0]!='1'&&str[0]!='2')

cout<<"你输入错误,请重新输入."<<endl;
cin>>str;

cout<<"你真的要删除吗? 1->删除 2->取消"<<endl;
string s;
cin>>s;
if(str[0]=='1')

if(str[0]=='1')

Delete(head,delStr,1);


else

Delete(head,delStr,2);


else

cout<<"你已经取消删除了."<<endl;


else

cout<<"你真的要删除全部数据吗?这样会使你的数据全部丢失哦."<<endl;
cout<<"1->全部删除 2->取消删除"<<endl;
cin>>str;
if(str[0]=='1')

DeleteAll(head);

else

cout<<"你已经取消删除了."<<endl;





void PaiMing(string str, student* head)

string s;
cout<<"欢迎使用排名功能"<<endl<<endl;
cout<<"排名选择: 1->升序 2->降序"<<endl;
cin>>s;
cout<<"请输入要按什么排名?"<<endl;
cout<<"1->语文成绩 2->数学成绩 3->英语成绩 "
<<"4->总分 5->平均分 6->座号"<<endl;

cin>>str;

while(str[0]!='1' && str[0]!='2' &&
str[0]!='3' && str[0]!='4' &&
str[0]!='5' && str[0]!='6' )

cout<<"你输入错误,请重新输入."<<endl;
cin>>str;

cout<<"姓名:"<<setw(8)<<"座号:"<<setw(10)
<<"语文分数:"<<setw(10) <<"数学分数:"
<<setw(10)<<"英语分数:"<<setw(8)<<"总分数:"
<<setw(8)<<"平均分:"<<setw(6)<<"名次:"<<endl<<endl;
if(s[0]=='2')

switch(str[0])


case '1':
Sort(head,'1','1');
break;
case '2':
Sort(head,'2','1');
break;
case '3':
Sort(head,'3','1');
break;
case '4':
Sort(head,'4','1');
break;
case '5'
参考技术A 我不是高手,不过我写过一个学生信息管理的东西,有源代码,
我贴在一个论坛上了。
http://bbs.bc-cn.net/dispbbs.asp?boardid=5&replyid=486453&id=83340&page=1&skin=0&star=1
你可以去看一下,交作业应该可以哈 。。。
参考技术B 课程设计之类的最好自己做,这样才能提高自己的c能力.
做完这几个题目就会发现你会喜欢上c的
参考技术C 我上大一的时候也做过这样的题,很有意思的.
当你做出的时候回感觉自己很有成就感的 !
参考技术D hehe,我现在也不太会 这些题都在我油箱里,可是我不想给你,因为自己做才会提高~!

以上是关于高分悬赏,c语言高手请进的主要内容,如果未能解决你的问题,请参考以下文章

急!高分悬赏!求c语言高手!!!二叉树输入中如何判断输入是不是合法?

C语言编程文本保存问题。。高分悬赏

C语言高手请进

高分悬赏C语言题目!!!

C语言高手请进!!!

C语言高手请进!!救急。。