谁帮我把这个C++程序改成C的?我一直改不成功。急,急,急,谢谢

来源:百度知道 编辑:UC知道 时间:2024/05/26 11:02:56
#include<iostream.h>
#include<string.h>
#include<fstream.h>
class stu
{
char name[20];
double math,chinese,english,average,sum;
public:
stu(){ }
stu(char n[20],double ma,double chin,double eng)
{
strcpy(name,n);
math=ma;
chinese=chin;
english=eng;
}
double getsum()
{
sum=chinese+english+math;
return sum;
}
double getaver()
{
average=getsum()/3;
return average;
}
friend void main();
};

void main()
{
cout<<"请选择您需要的操作!"<<endl;
cout<<"操作:"<<endl;
cout<<"(0)数据录入"<<endl;
cout<<"(1)增加人员"<<endl;
cout<<"(2)删除人员"<<endl;
cout<<"(3)修改数据"<<endl;
cout<<"查询:"<<endl;
cout<<"(4)按总成绩查询"<<e

class改成struct,成员方法改成单独的函数,参数中增加一个stu类型的参数.
其他无非是把C++的输入输出语句改成C的,没什么难的

接楼上的,具体做法是把子cout<<""改为printf("")
其它的就像楼上所说的,稍微改下就可以了!

class改成struct,成员方法改成单独的函数,参数中增加一个stu类型的参数.
其他无非是把C++的输入输出语句改成C的,没什么难的