求一个c++课程设计

作者&投稿:焦怨 (若有异议请与网页底部的电邮联系)
C++课程设计~

《C++课程设计》

课程设计题目:学生成绩管理系统

学生班级:*****

学生姓名:*****

学生学号:*****

(2)学生成绩管理系统需求与功能分析

学生成绩的录入、统计、查询、修改、删除、输出。 画出功能结构图。

(3)学生成绩管理系统的数据结构表

序号 成员名(字段名) 数据类型 长度 字段含义

1 class_0 char 20 班级

2 num int 学号

3 name char 8 姓名

4 elec flaot 电子技术

5 c_prog float C 程序设计

6 media flaot 多媒体技术

7 eng float 大学英语

8 math float 高等数学

9 sport float 大学体育

10 polity float 马克思主义政治经济学

11 ave float 平均成绩

12 order int 名次

(4)学生成绩管理系统测试数据表

class_0 num name elec c_prog media eng math sport polity ave order

网络30331 3033101 马云飞 80 70 60 70 70 60 80 表中其余数据自己编造。

(5)使用链表编写程序(手写源程序代码,并给出注解)

0)定义链表结点

1)主函数main():定义链表头指针,调用录入、统计等函数对成绩表进行处理;

2)建立链表函数Create():输入班级到政治课成绩信息;

3)统计函数Statistic():计算平均成绩;

4)查询函数Lookup():查询指定学号学生成绩记录;

5)修改函数Modify():修改指定学号学生成绩记录;

6)删除函数Delete():删除指定学号学生记录;

7)输出函数Output():输出班级所有学生成绩记录;

8)插入函数Insert():按平均分顺序插入新结点。

9) 排序函数Sort():按平均分对学生成绩记录项进行降序排序;

程序如下:

#include
#include
#include
#include
#include
using namespace std;

struct Node//定义链表结点
{

char* class_0;//班级
int number;
char* name;//姓名
float elec;//电子技术成绩
float c_prog;//C程序设计成绩
float media;//多媒体技术成绩
float eng;//大学英语成绩
float math;//高等数学成绩
float sport;//大学体育成绩
float polity;//马克思主义政治经济学成绩
float ave;//平均成绩
int order;//名次
Node* link;
Node(){link=NULL;}
Node(int _number,char* _class_0,char* _name,float _elec,
float _c_prog,float _media,float _eng,float _math,
float _sport,float _polity,float _ave,int _order,Node* next)
{
number=_number;
class_0=new char[21];
strcpy(class_0,_class_0);
name=new char[9];
strcpy(name,_name);
elec=_elec;
c_prog=_c_prog;
media=_media;
eng=_eng;
math=_math;
sport=_sport;
polity=_polity;
ave=_ave;
order=_order;
link=next;
}
~Node()
{
delete []class_0;
delete []name;
}

};
class StudentScore
{
private:
Node* first;//链表的头指针
int choice;//选择数据的读入方式
int fileNum;//当前文件数减一
int fileLoc;//定位当前文件
string* fileName;
int operChoice;
int RecordLength;
public:
StudentScore();
void Save();
void BuildList();//手工建立成绩链表
void ReadInfo(int k);//从内存中读入学生信息
void ClearList();
void Statistic();
void Sort();
void Add();
void Delete();
void PrintList();
void Menu();
};
StudentScore::StudentScore()
{
RecordLength=0;
operChoice=0;
first=NULL;
choice=0;
fileLoc=0;
fileNum=0;
fileName=new string[10];//最多可以存10个文件
}
int GetOrder(Node* first,float ave);
void StudentScore::BuildList()
{
int _number;//学号
char* _class_0=new char[21];//班级
char* _name=new char[9];//姓名
float _elec;//电子技术成绩
float _c_prog;//C程序设计成绩
float _media;//多媒体技术成绩
float _eng;//大学英语成绩
float _math;//高等数学成绩
float _sport;//大学体育成绩
float _polity;//马克思主义政治经济学成绩
float _ave;//平均成绩
int _order;//名次
char c;
Node *p,*r=NULL;
first=NULL;
cout<<"您要输入学生成绩信息?"<<endl;
while((c=getchar())=='n');
while(tolower(c)!='n')
{
cin>>_class_0;//班级
cin>>_number;
cin>>_name;//姓名
cin>>_elec;
cin>>_c_prog;
cin>>_media;
cin>>_eng;
cin>>_math;
cin>>_sport;
cin>>_polity;
_ave=(_elec+_c_prog+_media+_eng+_math+_sport+_polity)/7;//求得平均成绩
_order=GetOrder(first,_ave);

p=new Node(_number,_class_0,_name,_elec,
_c_prog,_media,_eng,_math,_sport,_polity,
_ave,_order,NULL);//建立一个新的结点储存信息

if(first!=NULL)
r->link=p;
else first=p;
r=p;
RecordLength++;
cout<<"您要输入学生成绩信息?"<<endl;
while((c=getchar())=='n');
}
}
int GetOrder(Node* first,float ave)//名次记录有严重问题
{
int order=1;
Node* temp=first;
for(;temp;temp=temp->link)
{ if(temp->ave>ave) order++;
if(temp->aveorder)++;
}
return order;
}

void StudentScore::Statistic()
{
Node* temp=first;
float a_elec=0.0;//电子技术成绩
float a_c_prog=0.0;//C程序设计成绩
float a_media=0.0;//多媒体技术成绩
float a_eng=0.0;//大学英语成绩
float a_math=0.0;//高等数学成绩
float a_sport=0.0;//大学体育成绩
float a_polity=0.0;//马克思主义政治经济学成绩
int i=0;
while(temp)
{
a_elec+=temp->elec;
a_c_prog+=temp->c_prog;
a_media+=temp->media;
a_eng+=temp->eng;
a_math+=temp->math;
a_sport+=temp->sport;
a_polity+=temp->polity;
i++;
temp=temp->link;
}
a_elec=a_elec/i;
a_c_prog=a_c_prog/i;
a_media=a_media/i;
a_eng=a_eng/i;
a_math=a_math/i;
a_sport=a_sport/i;
a_polity=a_polity/i;
cout<<"电子技术平均成绩为:"<<a_elec<<endl;
cout<<"c程序设计平均成绩为:"<<a_c_prog<<endl;
cout<<"多媒体技术平均成绩为:"<<a_media<<endl;
cout<<"英语平均成绩为:"<<a_eng<<endl;
cout<<"高等数学平均成绩为:"<<a_math<<endl;
cout<<"体育平均成绩为:"<<a_sport<<endl;
cout<<"政治平均成绩为:"<<a_polity<<endl;
}
void StudentScore::Delete()
{
int studNum;
Node* p;
Node* temp=first;
cout<<"请输入要删除的学生学号"<<endl;
cin>>studNum;
float average;
for(;temp;temp=temp->link)
{
coutnumber;

if(temp->number==studNum)
{
average=temp->ave;

if(temp==first)//说明是第一次
{
first=first->link;
delete temp;
break;//如果不跳出的话 temp=temp->link会出错
}
else
{
p->link=temp->link;
delete temp;
break;
}
}
p=temp;
RecordLength--;


}
//下面修改学生排名
temp=first;
for(;temp;temp=temp->link)
if(temp->aveorder--;

}
void StudentScore::Add()
{
int _number;//学号
char* _class_0=new char[21];//班级
char* _name=new char[9];//姓名
float _elec;//电子技术成绩
float _c_prog;//C程序设计成绩
float _media;//多媒体技术成绩
float _eng;//大学英语成绩
float _math;//高等数学成绩
float _sport;//大学体育成绩
float _polity;//马克思主义政治经济学成绩
float _ave;//平均成绩
int _order;//名次
char c;
Node *p,*r=NULL;
r=first;
while(r->link)
r=r->link;

// first=NULL;
cout<<"您要输入学生成绩信息?"<<endl;
while((c=getchar())=='n');
while(tolower(c)!='n')
{
cin>>_class_0;//班级
cin>>_number;
cin>>_name;//姓名
cin>>_elec;
cin>>_c_prog;
cin>>_media;
cin>>_eng;
cin>>_math;
cin>>_sport;
cin>>_polity;
_ave=(_elec+_c_prog+_media+_eng+_math+_sport+_polity)/7;//求得平均成绩
//写一个返回排名的程序
_order=GetOrder(first,_ave);

p=new Node(_number,_class_0,_name,_elec,
_c_prog,_media,_eng,_math,_sport,_polity,
_ave,_order,NULL);//建立一个新的结点储存信息

if(first!=NULL)
r->link=p;
else first=p;
r=p;
RecordLength++;
cout<<"您要输入学生成绩信息?"<<endl;
while((c=getchar())=='n');
}

}
void StudentScore::Sort()//简单bubble排序从高分到低分排序
{
int i=0;
Node* temp=first;
Node* before;
// Node* p=first;
for(;temp->link;)
{
if(temp->avelink->ave)
{

if(temp==first)//说明是第一个结点
{
first=first->link;
// p=temp;
// temp=temp->link;
temp->link=temp->link->link;
first->link=temp;
before=first;
}
else//不是第一个结点
{
before->link=temp->link;
temp->link=temp->link->link;
before->link->link=temp;
before=before->link;
}
}
else
{
temp=temp->link;
}


i++;//计算次数
}
for(;i>0;i--)
{
temp=first;
for(int j=0;j<i;j++)
{
if(temp->avelink->ave)
{
cout<<"small!"<<endl;
if(temp==first)//说明是第一个结点
{
first=first->link;
// p=temp;
// temp=temp->link;
temp->link=temp->link->link;
first->link=temp;
before=first;
}
else//不是第一个结点
{
before->link=temp->link;
temp->link=temp->link->link;
before->link->link=temp;
before=before->link;
}
}
else
{
temp=temp->link;
}
}
}

}
/*
bool IsSorted(Node* first)
{
for(;first;first=first->link)
if(first->avelink->ave) return false;
return true;
}*/

void StudentScore::PrintList()//打印链表程序
{
cout<<"The list contains:"<<endl;
Node* temp=first;
for(;temp;temp=temp->link)
{
coutclass_0name<<endl;
coutorder<<endl;
}
}

void StudentScore::ClearList()//清除链表
{
Node* p=new Node;
while(first)
{
p=first->link;
delete first;
first=p;
}
}

//读函数
void StudentScore::ReadInfo(int k)//读第k个文件的信息存入链表
{
// int wordLength;//记录子段长度
int _number;//学号
char* _class_0=new char[21];//班级
char* _name=new char[9];//姓名
float _elec;//电子技术成绩
float _c_prog;//C程序设计成绩
float _media;//多媒体技术成绩
float _eng;//大学英语成绩
float _math;//高等数学成绩
float _sport;//大学体育成绩
float _polity;//马克思主义政治经济学成绩
float _ave;//平均成绩
int _order;//名次
Node *p,*r=NULL;
first=NULL;
ifstream Infile(fileName[k].c_str());
if(!Infile)
{
cout<<"file is not present!"<<endl;
return;
}
Infile>>RecordLength;
cout<<RecordLength;
for(int i=0;i<RecordLength;i++)
{
Infile>>_class_0;//班级
// cout<<_class_0;
Infile>>_number;
Infile>>_name;//姓名
Infile>>_elec;
Infile>>_c_prog;
Infile>>_media;
Infile>>_eng;
Infile>>_math;
Infile>>_sport;
Infile>>_polity;
Infile>>_ave;
Infile>>_order;
_ave=(_elec+_c_prog+_media+_eng+_math+_sport+_polity)/7;//求得平均成绩
//写一个返回排名的程序
_order=GetOrder(first,_ave);

p=new Node(_number,_class_0,_name,_elec,
_c_prog,_media,_eng,_math,_sport,_polity,
_ave,_order,NULL);//建立一个新的结点储存信息

if(first!=NULL)
r->link=p;
else first=p;
r=p;
}

}
void StudentScore::Save()
{
string tempName;
cout<<"请输入将要保存的文件名:"<<endl;
//要判断是否跟现有文件重名
cin>>tempName;
ofstream savefile(tempName.c_str());//要做一个转换
Node* temp=first;
savefile<<RecordLength<<endl;
for(;temp;temp=temp->link)
{
savefileclass_0numbernameelec<<" "
c_progmediaengmath<<" "
sportpolityaveorder<<endl;
}
savefile.close();

//读取文件表信息
ifstream Readfileinfo("FileRecord.txt");
Readfileinfo>>fileNum;
for(int i=0;i<fileNum;i++)
Readfileinfo>>fileName[i];
Readfileinfo.close();
fileNum++;
fileName[i]=tempName;
//修改文件表信息
ofstream changefile("FileRecord.txt");
changefile<<fileNum<<endl;
for(i=0;i<fileNum;i++)
changefile<<fileName[i]<<endl;
changefile.close();
}

void StudentScore::Menu()
{
cout<<"请您选择数据的读入方式:"<<endl;
cout<<"(1) 重新手动建立一份新的数据表"<<endl;
cout<<"(2) 从文件中读入数据"<<endl;
cout<<"请选择:";
cin>>choice;
if(choice==1)
{
BuildList();
}
if(choice==2)
{
cout<<"当前有如下文件,请选择读入文件:"<<endl;
ifstream fileRecord("fileRecord.txt");
if(!fileRecord)
{
cout<<"fileRecord is not present!"<<endl;
return;
}
fileRecord>>fileNum;
cout<<"当前有"<<fileNum<<"个文件:"<<endl;
for(int i=0;i<fileNum;i++)
{
fileRecord>>fileName[i];
cout<<fileName[i]<<" ";
}
cout<<"请您选择一个文件:";
cin>>fileLoc;
ReadInfo(fileLoc-1);
PrintList();

}
cout<<"请选择您需要的操作:"<<endl;
cout<<"(1) 统计学生各科成绩"<<endl;
cout<<"(2) 删除某个学生成绩记录"<<endl;
cout<<"(3) 增加某个学生成绩记录"<<endl;
cout<<"(4) 在链表中为所有学生成绩记录排序"<<endl;
cin>>operChoice;
if(operChoice==1)
Statistic();
if(operChoice==2)
Delete();
if(operChoice==3)
Add();
if(operChoice==4)
Sort();
Save();
ClearList();
}

int main()
{
cout<<"//////////////////////////////////"<<endl;
cout<<"欢迎使用学生成绩管理系统!"<<endl;
cout<<"//////////////////////////////////"<<endl;
cout<<endl;
cout<<endl;
StudentScore s;
s.Menu();
return 0;
}

《C++课程设计》

课程设计题目:学生成绩管理系统

学生班级:*****

学生姓名:*****

学生学号:*****

(2)学生成绩管理系统需求与功能分析

学生成绩的录入、统计、查询、修改、删除、输出。 画出功能结构图。

(3)学生成绩管理系统的数据结构表

序号 成员名(字段名) 数据类型 长度 字段含义

1 class_0 char 20 班级

2 num int 学号

3 name char 8 姓名

4 elec flaot 电子技术

5 c_prog float C 程序设计

6 media flaot 多媒体技术

7 eng float 大学英语

8 math float 高等数学

9 sport float 大学体育

10 polity float 马克思主义政治经济学

11 ave float 平均成绩

12 order int 名次

(4)学生成绩管理系统测试数据表

class_0 num name elec c_prog media eng math sport polity ave order

网络30331 3033101 马云飞 80 70 60 70 70 60 80 表中其余数据自己编造。

(5)使用链表编写程序(手写源程序代码,并给出注解)

0)定义链表结点

1)主函数main():定义链表头指针,调用录入、统计等函数对成绩表进行处理;

2)建立链表函数Create():输入班级到政治课成绩信息;

3)统计函数Statistic():计算平均成绩;

4)查询函数Lookup():查询指定学号学生成绩记录;

5)修改函数Modify():修改指定学号学生成绩记录;

6)删除函数Delete():删除指定学号学生记录;

7)输出函数Output():输出班级所有学生成绩记录;

8)插入函数Insert():按平均分顺序插入新结点。

9) 排序函数Sort():按平均分对学生成绩记录项进行降序排序;

程序如下:

#include
#include
#include
#include
#include
using namespace std;

struct Node//定义链表结点
{

char* class_0;//班级
int number;
char* name;//姓名
float elec;//电子技术成绩
float c_prog;//C程序设计成绩
float media;//多媒体技术成绩
float eng;//大学英语成绩
float math;//高等数学成绩
float sport;//大学体育成绩
float polity;//马克思主义政治经济学成绩
float ave;//平均成绩
int order;//名次
Node* link;
Node(){link=NULL;}
Node(int _number,char* _class_0,char* _name,float _elec,
float _c_prog,float _media,float _eng,float _math,
float _sport,float _polity,float _ave,int _order,Node* next)
{
number=_number;
class_0=new char[21];
strcpy(class_0,_class_0);
name=new char[9];
strcpy(name,_name);
elec=_elec;
c_prog=_c_prog;
media=_media;
eng=_eng;
math=_math;
sport=_sport;
polity=_polity;
ave=_ave;
order=_order;
link=next;
}
~Node()
{
delete []class_0;
delete []name;
}

};
class StudentScore
{
private:
Node* first;//链表的头指针
int choice;//选择数据的读入方式
int fileNum;//当前文件数减一
int fileLoc;//定位当前文件
string* fileName;
int operChoice;
int RecordLength;
public:
StudentScore();
void Save();
void BuildList();//手工建立成绩链表
void ReadInfo(int k);//从内存中读入学生信息
void ClearList();
void Statistic();
void Sort();
void Add();
void Delete();
void PrintList();
void Menu();
};
StudentScore::StudentScore()
{
RecordLength=0;
operChoice=0;
first=NULL;
choice=0;
fileLoc=0;
fileNum=0;
fileName=new string[10];//最多可以存10个文件
}
int GetOrder(Node* first,float ave);
void StudentScore::BuildList()
{
int _number;//学号
char* _class_0=new char[21];//班级
char* _name=new char[9];//姓名
float _elec;//电子技术成绩
float _c_prog;//C程序设计成绩
float _media;//多媒体技术成绩
float _eng;//大学英语成绩
float _math;//高等数学成绩
float _sport;//大学体育成绩
float _polity;//马克思主义政治经济学成绩
float _ave;//平均成绩
int _order;//名次
char c;
Node *p,*r=NULL;
first=NULL;
cout<<"您要输入学生成绩信息?"<<endl;
while((c=getchar())=='n');
while(tolower(c)!='n')
{
cin>>_class_0;//班级
cin>>_number;
cin>>_name;//姓名
cin>>_elec;
cin>>_c_prog;
cin>>_media;
cin>>_eng;
cin>>_math;
cin>>_sport;
cin>>_polity;
_ave=(_elec+_c_prog+_media+_eng+_math+_sport+_polity)/7;//求得平均成绩
_order=GetOrder(first,_ave);

p=new Node(_number,_class_0,_name,_elec,
_c_prog,_media,_eng,_math,_sport,_polity,
_ave,_order,NULL);//建立一个新的结点储存信息

if(first!=NULL)
r->link=p;
else first=p;
r=p;
RecordLength++;
cout<<"您要输入学生成绩信息?"<<endl;
while((c=getchar())=='n');
}
}
int GetOrder(Node* first,float ave)//名次记录有严重问题
{
int order=1;
Node* temp=first;
for(;temp;temp=temp->link)
{ if(temp->ave>ave) order++;
if(temp->aveorder)++;
}
return order;
}

void StudentScore::Statistic()
{
Node* temp=first;
float a_elec=0.0;//电子技术成绩
float a_c_prog=0.0;//C程序设计成绩
float a_media=0.0;//多媒体技术成绩
float a_eng=0.0;//大学英语成绩
float a_math=0.0;//高等数学成绩
float a_sport=0.0;//大学体育成绩
float a_polity=0.0;//马克思主义政治经济学成绩
int i=0;
while(temp)
{
a_elec+=temp->elec;
a_c_prog+=temp->c_prog;
a_media+=temp->media;
a_eng+=temp->eng;
a_math+=temp->math;
a_sport+=temp->sport;
a_polity+=temp->polity;
i++;
temp=temp->link;
}
a_elec=a_elec/i;
a_c_prog=a_c_prog/i;
a_media=a_media/i;
a_eng=a_eng/i;
a_math=a_math/i;
a_sport=a_sport/i;
a_polity=a_polity/i;
cout<<"电子技术平均成绩为:"<<a_elec<<endl;
cout<<"c程序设计平均成绩为:"<<a_c_prog<<endl;
cout<<"多媒体技术平均成绩为:"<<a_media<<endl;
cout<<"英语平均成绩为:"<<a_eng<<endl;
cout<<"高等数学平均成绩为:"<<a_math<<endl;
cout<<"体育平均成绩为:"<<a_sport<<endl;
cout<<"政治平均成绩为:"<<a_polity<<endl;
}
void StudentScore::Delete()
{
int studNum;
Node* p;
Node* temp=first;
cout<<"请输入要删除的学生学号"<<endl;
cin>>studNum;
float average;
for(;temp;temp=temp->link)
{
coutnumber;

if(temp->number==studNum)
{
average=temp->ave;

if(temp==first)//说明是第一次
{
first=first->link;
delete temp;
break;//如果不跳出的话 temp=temp->link会出错
}
else
{
p->link=temp->link;
delete temp;
break;
}
}
p=temp;
RecordLength--;


}
//下面修改学生排名
temp=first;
for(;temp;temp=temp->link)
if(temp->aveorder--;

}
void StudentScore::Add()
{
int _number;//学号
char* _class_0=new char[21];//班级
char* _name=new char[9];//姓名
float _elec;//电子技术成绩
float _c_prog;//C程序设计成绩
float _media;//多媒体技术成绩
float _eng;//大学英语成绩
float _math;//高等数学成绩
float _sport;//大学体育成绩
float _polity;//马克思主义政治经济学成绩
float _ave;//平均成绩
int _order;//名次
char c;
Node *p,*r=NULL;
r=first;
while(r->link)
r=r->link;

// first=NULL;
cout<<"您要输入学生成绩信息?"<<endl;
while((c=getchar())=='n');
while(tolower(c)!='n')
{
cin>>_class_0;//班级
cin>>_number;
cin>>_name;//姓名
cin>>_elec;
cin>>_c_prog;
cin>>_media;
cin>>_eng;
cin>>_math;
cin>>_sport;
cin>>_polity;
_ave=(_elec+_c_prog+_media+_eng+_math+_sport+_polity)/7;//求得平均成绩
//写一个返回排名的程序
_order=GetOrder(first,_ave);

p=new Node(_number,_class_0,_name,_elec,
_c_prog,_media,_eng,_math,_sport,_polity,
_ave,_order,NULL);//建立一个新的结点储存信息

if(first!=NULL)
r->link=p;
else first=p;
r=p;
RecordLength++;
cout<<"您要输入学生成绩信息?"<<endl;
while((c=getchar())=='n');
}

}
void StudentScore::Sort()//简单bubble排序从高分到低分排序
{
int i=0;
Node* temp=first;
Node* before;
// Node* p=first;
for(;temp->link;)
{
if(temp->avelink->ave)
{

if(temp==first)//说明是第一个结点
{
first=first->link;
// p=temp;
// temp=temp->link;
temp->link=temp->link->link;
first->link=temp;
before=first;
}
else//不是第一个结点
{
before->link=temp->link;
temp->link=temp->link->link;
before->link->link=temp;
before=before->link;
}
}
else
{
temp=temp->link;
}


i++;//计算次数
}
for(;i>0;i--)
{
temp=first;
for(int j=0;j<i;j++)
{
if(temp->avelink->ave)
{
cout<<"small!"<<endl;
if(temp==first)//说明是第一个结点
{
first=first->link;
// p=temp;
// temp=temp->link;
temp->link=temp->link->link;
first->link=temp;
before=first;
}
else//不是第一个结点
{
before->link=temp->link;
temp->link=temp->link->link;
before->link->link=temp;
before=before->link;
}
}
else
{
temp=temp->link;
}
}
}

}
/*
bool IsSorted(Node* first)
{
for(;first;first=first->link)
if(first->avelink->ave) return false;
return true;
}*/

void StudentScore::PrintList()//打印链表程序
{
cout<<"The list contains:"<<endl;
Node* temp=first;
for(;temp;temp=temp->link)
{
coutclass_0name<<endl;
coutorder<<endl;
}
}

void StudentScore::ClearList()//清除链表
{
Node* p=new Node;
while(first)
{
p=first->link;
delete first;
first=p;
}
}

//读函数
void StudentScore::ReadInfo(int k)//读第k个文件的信息存入链表
{
// int wordLength;//记录子段长度
int _number;//学号
char* _class_0=new char[21];//班级
char* _name=new char[9];//姓名
float _elec;//电子技术成绩
float _c_prog;//C程序设计成绩
float _media;//多媒体技术成绩
float _eng;//大学英语成绩
float _math;//高等数学成绩
float _sport;//大学体育成绩
float _polity;//马克思主义政治经济学成绩
float _ave;//平均成绩
int _order;//名次
Node *p,*r=NULL;
first=NULL;
ifstream Infile(fileName[k].c_str());
if(!Infile)
{
cout<<"file is not present!"<<endl;
return;
}
Infile>>RecordLength;
cout<<RecordLength;
for(int i=0;i<RecordLength;i++)
{
Infile>>_class_0;//班级
// cout<<_class_0;
Infile>>_number;
Infile>>_name;//姓名
Infile>>_elec;
Infile>>_c_prog;
Infile>>_media;
Infile>>_eng;
Infile>>_math;
Infile>>_sport;
Infile>>_polity;
Infile>>_ave;
Infile>>_order;
_ave=(_elec+_c_prog+_media+_eng+_math+_sport+_polity)/7;//求得平均成绩
//写一个返回排名的程序
_order=GetOrder(first,_ave);

p=new Node(_number,_class_0,_name,_elec,
_c_prog,_media,_eng,_math,_sport,_polity,
_ave,_order,NULL);//建立一个新的结点储存信息

if(first!=NULL)
r->link=p;
else first=p;
r=p;
}

}
void StudentScore::Save()
{
string tempName;
cout<<"请输入将要保存的文件名:"<<endl;
//要判断是否跟现有文件重名
cin>>tempName;
ofstream savefile(tempName.c_str());//要做一个转换
Node* temp=first;
savefile<<RecordLength<<endl;
for(;temp;temp=temp->link)
{
savefileclass_0numbernameelec<<" "
c_progmediaengmath<<" "
sportpolityaveorder<<endl;
}
savefile.close();

//读取文件表信息
ifstream Readfileinfo("FileRecord.txt");
Readfileinfo>>fileNum;
for(int i=0;i<fileNum;i++)
Readfileinfo>>fileName[i];
Readfileinfo.close();
fileNum++;
fileName[i]=tempName;
//修改文件表信息
ofstream changefile("FileRecord.txt");
changefile<<fileNum<<endl;
for(i=0;i<fileNum;i++)
changefile<<fileName[i]<<endl;
changefile.close();
}

void StudentScore::Menu()
{
cout<<"请您选择数据的读入方式:"<<endl;
cout<<"(1) 重新手动建立一份新的数据表"<<endl;
cout<<"(2) 从文件中读入数据"<<endl;
cout<<"请选择:";
cin>>choice;
if(choice==1)
{
BuildList();
}
if(choice==2)
{
cout<<"当前有如下文件,请选择读入文件:"<<endl;
ifstream fileRecord("fileRecord.txt");
if(!fileRecord)
{
cout<<"fileRecord is not present!"<<endl;
return;
}
fileRecord>>fileNum;
cout<<"当前有"<<fileNum<<"个文件:"<<endl;
for(int i=0;i<fileNum;i++)
{
fileRecord>>fileName[i];
cout<<fileName[i]<<" ";
}
cout<<"请您选择一个文件:";
cin>>fileLoc;
ReadInfo(fileLoc-1);
PrintList();

}
cout<<"请选择您需要的操作:"<<endl;
cout<<"(1) 统计学生各科成绩"<<endl;
cout<<"(2) 删除某个学生成绩记录"<<endl;
cout<<"(3) 增加某个学生成绩记录"<<endl;
cout<<"(4) 在链表中为所有学生成绩记录排序"<<endl;
cin>>operChoice;
if(operChoice==1)
Statistic();
if(operChoice==2)
Delete();
if(operChoice==3)
Add();
if(operChoice==4)
Sort();
Save();
ClearList();
}

int main()
{
cout<<"//////////////////////////////////"<<endl;
cout<<"欢迎使用学生成绩管理系统!"<<endl;
cout<<"//////////////////////////////////"<<endl;
cout<<endl;
cout<<endl;
StudentScore s;
s.Menu();
return 0;
}
请采纳答案,支持我一下。

// game.cpp : Defines the class behaviors for the application.
//

#include "stdafx.h"
#include "game.h"

#include "MainFrm.h"
#include "gameDoc.h"
#include "gameView.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CGameApp

BEGIN_MESSAGE_MAP(CGameApp, CWinApp)
//{{AFX_MSG_MAP(CGameApp)
ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
// Standard file based document commands
ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
// Standard print setup command
ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CGameApp construction

CGameApp::CGameApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}

/////////////////////////////////////////////////////////////////////////////
// The one and only CGameApp object

CGameApp theApp;

/////////////////////////////////////////////////////////////////////////////
// CGameApp initialization

BOOL CGameApp::InitInstance()
{
AfxEnableControlContainer();

// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.

#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif

// Change the registry key under which our settings are stored.
// TODO: You should modify this string to be something appropriate
// such as the name of your company or organization.
SetRegistryKey(_T("Local AppWizard-Generated Applications"));

LoadStdProfileSettings(); // Load standard INI file options (including MRU)

// Register the application's document templates. Document templates
// serve as the connection between documents, frame windows and views.

CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CGameDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CGameView));
AddDocTemplate(pDocTemplate);

// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);

// Dispatch commands specified on the command line
if (!ProcessShellCommand(cmdInfo))
return FALSE;

// The one and only window has been initialized, so show and update it.
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();

return TRUE;
}

/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About

class CAboutDlg : public CDialog
{
public:
CAboutDlg();

// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA

// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL

// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
// No message handlers
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};

CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}

void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

// App command to run the dialog
void CGameApp::OnAppAbout()
{
CAboutDlg aboutDlg;
aboutDlg.DoModal();
}

/////////////////////////////////////////////////////////////////////////////
// CGameApp message handlers

// game.h : main header file for the GAME application
//

#if !defined(AFX_GAME_H__37B9417B_40F7_4755_AD5E_9C78039ECD55__INCLUDED_)
#define AFX_GAME_H__37B9417B_40F7_4755_AD5E_9C78039ECD55__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#ifndef __AFXWIN_H__
#error include 'stdafx.h' before including this file for PCH
#endif

#include "resource.h" // main symbols

/////////////////////////////////////////////////////////////////////////////
// CGameApp:
// See game.cpp for the implementation of this class
//

class CGameApp : public CWinApp
{
public:
CGameApp();

// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CGameApp)
public:
virtual BOOL InitInstance();
//}}AFX_VIRTUAL

// Implementation
//{{AFX_MSG(CGameApp)
afx_msg void OnAppAbout();
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_GAME_H__37B9417B_40F7_4755_AD5E_9C78039ECD55__INCLUDED_)

// gameDoc.cpp : implementation of the CGameDoc class
//

#include "stdafx.h"
#include "game.h"

#include "gameDoc.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CGameDoc

IMPLEMENT_DYNCREATE(CGameDoc, CDocument)

BEGIN_MESSAGE_MAP(CGameDoc, CDocument)
//{{AFX_MSG_MAP(CGameDoc)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CGameDoc construction/destruction

CGameDoc::CGameDoc()
{
// TODO: add one-time construction code here

}

CGameDoc::~CGameDoc()
{
}

BOOL CGameDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;

// TODO: add reinitialization code here
// (SDI documents will reuse this document)

return TRUE;
}

/////////////////////////////////////////////////////////////////////////////
// CGameDoc serialization

void CGameDoc::Serialize(CArchive& ar)
{
if (ar.IsStoring())
{
// TODO: add storing code here
}
else
{
// TODO: add loading code here
}
}

/////////////////////////////////////////////////////////////////////////////
// CGameDoc diagnostics

#ifdef _DEBUG
void CGameDoc::AssertValid() const
{
CDocument::AssertValid();
}

void CGameDoc::Dump(CDumpContext& dc) const
{
CDocument::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CGameDoc commands

// gameDoc.h : interface of the CGameDoc class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_GAMEDOC_H__3747CE70_C9E0_4B2C_9C92_6A1AFA62F929__INCLUDED_)
#define AFX_GAMEDOC_H__3747CE70_C9E0_4B2C_9C92_6A1AFA62F929__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

class CGameDoc : public CDocument
{
protected: // create from serialization only
CGameDoc();
DECLARE_DYNCREATE(CGameDoc)

// Attributes
public:

// Operations
public:

// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CGameDoc)
public:
virtual BOOL OnNewDocument();
virtual void Serialize(CArchive& ar);
//}}AFX_VIRTUAL

// Implementation
public:
virtual ~CGameDoc();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif

protected:

// Generated message map functions
protected:
//{{AFX_MSG(CGameDoc)
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_GAMEDOC_H__3747CE70_C9E0_4B2C_9C92_6A1AFA62F929__INCLUDED_)
// gameView.cpp : implementation of the CGameView class
//
#include "stdafx.h"
#include "game.h"
#include "math.h"

#include "gameDoc.h"
#include "gameView.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CGameView

IMPLEMENT_DYNCREATE(CGameView, CView)

BEGIN_MESSAGE_MAP(CGameView, CView)
//{{AFX_MSG_MAP(CGameView)
ON_WM_LBUTTONDOWN()
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CGameView construction/destruction

CGameView::CGameView()
{
// TODO: add construction code here
count=0;
for(int i=0;i<=10;i++)
for(int j=0;j<=10;j++)
Board[i][j]=0;

m_bBitmap.LoadBitmap(IDB_BITMAP1);
m_wBitmap.LoadBitmap(IDB_BITMAP2);
m_bBitmap.GetObject(sizeof(bmInfo_b),&bmInfo_b);
m_wBitmap.GetObject(sizeof(bmInfo_w),&bmInfo_w);//构造函数中初始化各变量

}

CGameView::~CGameView()
{
}

BOOL CGameView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs

return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CGameView drawing

void CGameView::OnDraw(CDC* pDC)//绘制棋盘
{
CGameDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
CBrush brush(RGB(255,255,255));//背景色 白色

pDC->SelectObject(&brush);

HRGN Rgn;
Rgn=CreateRectRgn(0,0,500,500);
FrameRgn(*pDC,Rgn,brush,500,500);

CPen pen;
pen.CreatePen(PS_SOLID,1,RGB(0,0,0));//实线 黑色
for(int i=0;i<=10;i++)
{
pDC->MoveTo(40,25*(i)+40);
pDC->LineTo(290,25*(i)+40);
}//绘横线
for( i=0;i<=10;i++){
pDC->MoveTo(25*(i)+40,40);
pDC->LineTo(25*(i)+40,290);
}//绘竖线
for( i=0;i<=10;i++)
for(int j=0;j<=10;j++)
Board[i][j]=0;//清空旗子

}

/////////////////////////////////////////////////////////////////////////////
// CGameView printing

BOOL CGameView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}

void CGameView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}

void CGameView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}

/////////////////////////////////////////////////////////////////////////////
// CGameView diagnostics

#ifdef _DEBUG
void CGameView::AssertValid() const
{
CView::AssertValid();
}

void CGameView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}

CGameDoc* CGameView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CGameDoc)));
return (CGameDoc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CGameView message handlers

void CGameView::Draw_Change(CDC* dcComp, CPoint point, int flag,CBitmap& bitmap)
{
BITMAP bmInfo;
bitmap.GetObject(sizeof(bmInfo),&bmInfo);

CDC* dc;
dc=CWnd::GetDC();

for(int i=0;i<=10;i++)
for(int j=0;j<=10;j++)
{
if(fabs(point.x-40-25*i)<bmInfo.bmWidth/2&&fabs(point.y-40-25*j)<bmInfo.bmHeight/2&&Board[i][j]==0)
{
dcComp->SelectObject(&bitmap);
dc->BitBlt(40+25*i-bmInfo.bmWidth/2,40+25*j-bmInfo.bmHeight/2,bmInfo.bmWidth,bmInfo.bmHeight,dcComp,0,0,SRCCOPY);//判断是否在范围内若在载入位图
Board[i][j]=flag;
count++;
}
}

}

void CGameView::Judge()
{
CDC* dc;
dc=CWnd::GetDC();
for(int i=0;i<=6;i++)
for(int j=0;j<=10;j++)
{
if(Board[i][j]!=0)
if(Board[i][j]==Board[i+1][j]&&Board[i][j]==Board[i+2][j]&&Board[i+3][j]==Board[i][j]&&Board[i+4][j]==Board[i][j])
if(Board[i][j]==1)
{
MessageBox("黑胜!");
CGameView::OnDraw(dc);
return;
}
else{
MessageBox("黄赢!");
CGameView::OnDraw(dc);
return;
}

}//判断横行

for(i=0;i<=10;i++)
for(int j=0;j<=6;j++)
{
if(Board[i][j]!=0)
if(Board[i][j]==Board[i][j+1]&&Board[i][j]==Board[i][j+2]&&Board[i][j+3]==Board[i][j]&&Board[i][j]==Board[i][j+4])
if(Board[i][j]==1)
{
MessageBox("黑胜!");
CGameView::OnDraw(dc);
return;
}
else{
MessageBox("黄赢!");
CGameView::OnDraw(dc);
return;
}
}//判断竖行

for(i=0;i<=6;i++)
for(int j=0;j<=6;j++)
{
if(Board[i][j]!=0)
if(Board[i][j]==Board[i+1][j+1]&&Board[i][j]==Board[i+2][j+2]&&Board[i+3][j+3]==Board[i][j]&&Board[i][j]==Board[i+4][j+4])
if(Board[i][j]==1){
MessageBox("黑胜!");
CGameView::OnDraw(dc);
return;}
else{
MessageBox("黄赢!");
CGameView::OnDraw(dc);
return;
}
}//判断右斜

for(i=0;i<=6;i++)
for(int j=4;j<=10;j++)
{
if(Board[i][j]!=0)
if(Board[i][j]==Board[i+1][j-1]&&Board[i][j]==Board[i+2][j-2]&&Board[i+3][j-3]==Board[i][j]&&Board[i][j]==Board[i+4][j-4])
if(Board[i][j]==1)
{
MessageBox("黑赢!");
CGameView::OnDraw(dc);
return;}
else{
MessageBox("黄赢!");
CGameView::OnDraw(dc);
return;
}//判断左斜
}
}

void CGameView::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CDC* dc;
dc=CWnd::GetDC();//获得相应的设备环境
CDC dcComp;
dcComp.CreateCompatibleDC(dc);//获得可载入位图的相应设备环境

if(count%2==1)
Draw_Change(&dcComp,point,1,m_bBitmap);
else
Draw_Change(&dcComp,point,2,m_wBitmap);//相应位置载入位图

Judge();//判断输赢
CView::OnLButtonDown(nFlags, point);
}
// gameView.h : interface of the CGameView class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_GAMEVIEW_H__6D8D2D59_A8FA_4534_AC2A_D610645FB7D0__INCLUDED_)
#define AFX_GAMEVIEW_H__6D8D2D59_A8FA_4534_AC2A_D610645FB7D0__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

class CGameView : public CView
{
protected: // create from serialization only
CGameView();
DECLARE_DYNCREATE(CGameView)

// Attributes
public:
CGameDoc* GetDocument();

// Operations
public:

// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CGameView)
public:
virtual void OnDraw(CDC* pDC); // overridden to draw this view
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
//}}AFX_VIRTUAL

// Implementation
public:
void Judge();//判断输赢
void Draw_Change(CDC* dcComp, CPoint point, int flag,CBitmap& bitmap);//判断是否在范围内,载入位图,即落棋子。
virtual ~CGameView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif

刚找到了个 但不太符合要求 还望借鉴
#include<iostream>
using namespace std;
int osheng(char a[][10]);//判断o子是否获胜的函数
int xsheng(char a[][10]);//判断x子是否获胜的函数
int he(char a[][10]);//判断是否平局(也就是棋盘下满了)的函数
void qipan(char a[10][10])//执行输出棋盘命令
{
for(int i=0;i<10;i++)
{
for(int j=0;j<10;j++)
cout<<a[i][j];
cout<<endl;
}
}
int main()
{
char a[10][10];
int x,y;
for(int i=0;i<10;i++)
for(int j=0;j<10;j++)
a[i][j]=' ';
qipan(a);
while(1)//用循环语句执行o,x交替下子,这些while语句看起来似乎是个死循环~实际上都会经过break结束
{
int a1=1;
while(1)
{ for(;a1;)
{ cout<<"请输入o子下的位置:";
cin>>x>>y; if(a[x][y]=='o'||a[x][y]=='x')//判断是否已有子
{cout<<"已有子请重下"<<",";continue;}
else if(x>=10||y>=10){cout<<"输入错误请重输"<<",";continue;}
else { a[x][y]='o'; a1=0; }} break;}

qipan(a);//下好o子后将棋盘显示
if(osheng(a))//判断o子是否已经获胜
{
cout<<"o子获胜"<<endl;
break;
}
while(1)//下x子
{
cout<<"请输入x子下的位置:"; cin>>x>>y;
if(a[x][y]=='o'||a[x][y]=='x'||x>=10||y>=10)
{
for( ; a[x][y]=='o'||a[x][y]=='x'; )
{cout<<"已有子请重下"; cout<<"请输入x子下的位置:"; cin>>x>>y;continue; }
for ( ; x>=10||y>=10||x; )
{cout<<"输入错误请重输"<<",";cout<<"请输入x子下的位置:";cin>>x>>y;continue ;}
a[x][y]='x';break;
}
else
{ a[x][y]='x'; break;
}
}
qipan(a);//再一次输出棋盘
if(xsheng(a))//判断x子是否已经获胜
{
cout<<"x子获胜"<<endl;
break;
}
if(he(a))//判断是否平局
{
cout<<"平局"<<endl;
break;
}
}
return 0;
}
int osheng(char a[][10])//别看起来这么多就吓到了,实际上想法很简单
{
int i,j;//判断横着的5个是否都相等
for(i=0;i<10;i++)
for(j=0;j<6;j++)
if(a[i][j]=='o'&&a[i][j+1]=='o'&&a[i][j+2]=='o'&&a[i][j+3]=='o'&&a[i][j+4]=='o')
return 1;
for(j=0;j<10;j++)//判断竖着的5个是否都相等
for(i=0;i<6;i++)
if(a[i][j]=='o'&&a[i+1][j]=='o'&&a[i+2][j]=='o'&&a[i+3][j]=='o'&&a[i+4][j]=='o')
return 1;
for(i=0;i<6;i++)//判断左斜5个
for(j=0;j<6;j++)
if(a[i][j]=='o'&&a[i+1][j+1]=='o'&&a[i+2][j+2]=='o'&&a[i+3][j+3]=='o'&&a[i+4][j+4]=='o')
return 1;
for(i=0;i<6;i++)//右斜5个
for(j=9;j>3;j--)
if(a[i][j]=='o'&&a[i+1][j-1]=='o'&&a[i+2][j-2]=='o'&&a[i+3][j-3]=='o'&&a[i+4][j-4]=='o')
return 1;
return 0;
}
int xsheng(char a[][10])//同o,只是改字符
{
int i,j;
for(i=0;i<10;i++)
for(j=0;j<6;j++)
if(a[i][j]=='x'&&a[i][j+1]=='x'&&a[i][j+2]=='x'&&a[i][j+3]=='x'&&a[i][j+4]=='x')
return 1;
for(j=0;j<10;j++)
for(i=0;i<6;i++)
if(a[i][j]=='x'&&a[i+1][j]=='x'&&a[i+2][j]=='x'&&a[i+3][j]=='x'&&a[i+4][j]=='x')
return 1;
for(i=0;i<6;i++)
for(j=0;j<6;j++)
if(a[i][j]=='x'&&a[i+1][j+1]=='x'&&a[i+2][j+2]=='x'&&a[i+3][j+3]=='x'&&a[i+4][j+4]=='x')
return 1;
for(i=0;i<6;i++)
for(j=9;j>3;j--)
if(a[i][j]=='x'&&a[i+1][j-1]=='x'&&a[i+2][j-2]=='x'&&a[i+3][j-3]=='x'&&a[i+4][j-4]=='x')
return 1;
return 0;
}
int he(char a[][10])
{
for(int i=0;i<10;i++)
for(int j=0;j<10;j++)
{
if(a[i][j]==' ')//当棋盘全部子都不是' '时才能return 1,即棋盘已下满
return 0;
}
return 1;
}

太可惜了 我们机房就有一个你需要的 是用C++编的 “在线五子棋”
可惜我们没有上机课了 不好意思了

你悬赏的分给我吧,别浪费!

http://tieba.baidu.com/f?kz=413221744
里面有很多程序。。。自己看看吧。。。


C语言课程设计
C语言课程设计 题目商品信息管理程序设计一个商品信息管理程序,商品信息包括:商品编号,商品名称,商品价格,商品数量,商品生产商等。该程序设计应该具有以下功能:1商品信息的添加2商品信息的删... 题目 商品信息管理程序 设计一个商品信息管理程序,商品信息包括:商品编号,商品名称,商品价格,商品数量,商品生产商等。该...

c语言课程设计—教师工作量管理系统源代码
printf("请输入该教师的课程设计工作量:\\n"); scanf("%d",&(p->info->cdesign)); printf("请输入该教师的毕业设计工作量:\\n"); scanf("%d",&(p->info->gdesign)); p->info->pos=0; p->info->total=p->info->lesson+p->info->exper+p->info->cdesign+p->info->gdesign;\/\/求总工作...

帮忙编c语言课程设计
首先,要求用户输入某个员工的职工编号,新的记录将插入在该记录之后;然后,提示用户输入一条新的记录信息,这些信息保存在新结构体类型的数组元素的各字段中;最后,该元素插入在已经确认位置的职工编号之后。 5.排序记录模块。该模块主要完成按职工工资降序排列功能(采用“冒泡法”即可)。二、课程设计的要求和过程管理本...

C语言程序设计课程设计报告怎么写啊?有谁有样本吗?谢啦!
1)输入下面的程序 include <stdio.h> void main( ){ printf(" 欢迎学习C语言程序设计!\\n ");} 2).仔细观察屏幕的输入程序,检查有无错误。3).对该程序进行编译,查看编译输出窗口,检查是否有错误,有错误需要改正错误。无错误就可以运行程序。【实验1-2】设计一个程序,已知矩形的两条边长...

c语言课程设计
2008-06-23 · TA获得超过141个赞 知道小有建树答主 回答量:1454 采纳率:0% 帮助的人:0 我也去答题访问个人页 展开全部 你这是vc吧 已赞过 已踩过< 你对这个回答的评价是? 评论 收起 其他类似问题 2014-07-07 c语言课程设计 1 2009-06-22 C语言课程设计报告要求 66 更多类似问题 > 为...

C语言学习要做一个课程设计,是关于个人物品管理的,但我现在一点思路都没...
课程设计一般包括以下几方面:1.设计任务描述(设计题目的内容及要求)2.设计的总体思路(系统的基本功能,具体设计思想,总的流程图)3.功能模块的详细设计(各个函数的设计及流程图)4.功能模块的调试及测试(就是上述各个函数的测试,如判断密码函数的测试)5.总结 6.致谢 参考文献 附录(全部源代码...

C语言 编程 课程设计 要交了,我还不会!!!很...
C语言 编程 课程设计 要交了,我还不会!!!很... 设计课题:飞机订票系统一、问题描述:假设某航空公司只有M架N个座位的飞机,每架飞机每天飞行一趟。通过该系统来实现机票的订购问题。二、功能要求:1.本系统采用一个包含N个数据的结... 设计课题:飞机订票系统一、问题描述:假设某航空公司只有M架N个座位的飞机...

请教高手发我一个C语言程序设计课程设计 内容是 职工工资管理的 源程序...
include "stdafx.h"include "iostream"include "string"include "list"include "cassert"using namespace std;\/ 编号、姓名、部门、应付工资、保险、税金、实付工资。其中实付工资由公式计算得到:实付工资=应付工资 - 保险- 税金 \/ struct employee{ string m_num;\/\/编号 string m_name;\/\/姓名 st...

求C语言课程设计一份
include<stdio.h> include<stdlib.h> include<ctype.h> include<string.h> include<conio.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 \\n");printf("\\t\\t | 1. Input Records...

C语言课程设计:学生学籍管理系统。有谁有代码给我做个参考吗?谢谢了...
{ 1 case '1': read(); \/\/调用建立链表的函数;输出链表信息;print();printf("\\nPress any key Continue ");\/\/getchar();getchar();break;case '2': \/\/调用按学号查找学生信息的函数;并输出查找结果信息;long c;printf("input the number you want to find:");scanf("%ld",&c);...

盈江县15219071557: C++课程设计 数据统计,平均值,方差问题功能描述:键盘输入20个数据.统计1:统计其中奇数个数是多少;统计2:统计其中素数个数是多少;统计3:统计... -
冯旺瑞琦:[答案] #include using namespace std; const int N=20; //统计1 int count1(double arr[]) { int sum=0; for(int i=0;i

盈江县15219071557: C++课程设计 -
冯旺瑞琦: 《C++课程设计》 课程设计题目:学生成绩管理系统 学生班级:***** 学生姓名:***** 学生学号:***** (2)学生成绩管理系统需求与功能分析 学生成绩的录入、统计、查询、修改、删除、输出. 画出功能结构图. (3)学生成绩管理系统的数据结...

盈江县15219071557: 求一个C++课程设计,急!!! -
冯旺瑞琦: 200分 今晚八点前 帮你搞好! 真是不好意思,超出了十五分钟给你.. 我的调试环境是vc6.0 win_xp 程序完全没有问题,如果你用其他的编译器我很难保证没有出错,因为不同版本的编译器的兼容性不同的.... 还有什么问题,给我信息... 你不要看...

盈江县15219071557: 高分急求C++ 课程设计 急!!!!!!!!!!!!!!!!!!! -
冯旺瑞琦: 1、新建一个MFC(exe)2、选择Dlg方式3、昨边的Resource里添加要加的图,假设为IDB_14、右键点"属性"5、类型选bitmap>图片选你加的图的句柄IDB_1 (其它窗口也类似操作) 关于最佳路径你可得写程序了,最笨的方法,写if...else if...else...

盈江县15219071557: C++课程设计
冯旺瑞琦: #include <stadio.h> #include "stdafx.h" using namespace std; int main() { int a,b,c,d,e; int i=0; for(a=2;a<=5;a++) { for(e=1;e<=4;e++) { for(b=1;b<=5;b++) { for(c=1;c<=5;c++) { for(d=1;d<=5;d++) { if(c==(d+1)||c==(d-1)) if((a!=b)&&(a!=c)&&(a!=d)&(...

盈江县15219071557: 急求C++课程设计 -
冯旺瑞琦: //a.h#include "string.h"class A{public: friend void out(char *o) { cout<<<endl; } char *m_str; void operator+=(A b) { char *st; int l1=strlen(m_str); ...

盈江县15219071557: C++课程设计 -
冯旺瑞琦: 对象:人员: 属性:code,name,月工资,岗位,年龄,性别,职位(经理,技术员等)) 方法:insert人员,delete人员,update人员,query人员 工资: 属性: 固定月薪,工作时间,小时工资,销售额度,提成, 方法: 计算工资{ 固定月薪+ 工作时间*小时工资(100元每小时)+ 销售额*4%提成+所辖部门销售额总额*0.5%}//注意根据不同情况处理不同的岗位工资,如:技术人员,则底薪为0,销售额为0,其他雷同. sort() 文件存储类 属性:需要记录文件的信息罗列 方法:存储文件,修改文件,创建文件.

盈江县15219071557: c++课程设计,各位大虾有空的话帮忙做下,小弟急用!!!谢谢各位了
冯旺瑞琦: 修改了下,改正几个bug,增加四则运算支持.不会出现除不尽的情况.============================WinTC1.91+WinXP调试成功 VC6+WinXP调试成功 P.S. 用C语言写的,拿去糊弄老师足够了.有一部分代码需要你自己改,比如输出"...

盈江县15219071557: 求c++程序课设 -
冯旺瑞琦: #include#include#include#include using namespace std;/* 各种头文件声明*/ char number[1000];//这是产生的随机数,变换成字符串类型,以便于比较 int num;//产生的随机数 int length;//随机数长度 char inputNumber[1000]={0};//用户输入...

盈江县15219071557: 帮忙做一个C++课程设计,紧急
冯旺瑞琦: #include <iostream> #include <string> #include <iomanip> #include <fstream> #include <cstdlib> using namespace std; class book { public: book();//默认构造函数 char inter_face();//首页 void add_person();//添加联系人 void del_...

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 星空见康网