c语言的iomanip.h错误,求解决问题,执行以下程序显示"eh.h is only for C++!",求解决...

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

#include

#include

#include"fstream.h"

#include

#include

using namespace std;

class student

{ private:

char name[20]; //姓名

double cpro,english,math,sport,law,hbpro,computer;//课程

int order, number; //名次,学号

public:

student(){}

student(char n[20],int nu,double cc,double eng,double ma,double sp,double l,double hb,double com)

{strcpy(name,n);

number=nu;

cpro=cc;

english=eng;math=ma;sport=sp;law=l;hbpro=hb;computer=com;

}

friend void main();

};

void main()

{

cout<

cout<

cout<

cout<

cout<

cout<

cout<

cout<

cout<

cout<

cout<

cout<

cout<

cout<

char p;char w;

student *s[50]; //指针对象,最多存50个学生数据

ofstream *file[50]; //负责对文件插入操作

int i=0;

int j=0;

int flag=0;

do //flag判断输入是否有效

{

cin>>p;

if((p>='0'&&p<='6'))

flag=1;

else

cout<

}while(flag==0);

do{

switch(p) //接收功能选项

{

case '0': //输入数据

{

char c;

char name[20];int number;double

cpro,english,math,sport,law,hbpro,computer;

do{

cout<

cin>>name;

cout<

cin>>number;

cout<

cin>>cpro;

cout<

cin>>english;

cout<

cin>>math;

cout<

cin>>sport;

cout<

cin>>law;

cout<

cin>>hbpro;

cout<

cin>>computer;

cout<

file[j]=new ofstream("D:\\document",ios::ate);

*file[j]<

<

<

j++;

s[i]=new student(name,

number,cpro,english,math,sport,law,hbpro,computer);

i++;

cout<

cin>>c;

cout<

do

{

if(c!='y'&&c!='n')

{

cout<

cin>>c;

}

else

flag=1;

}while(flag==0);

}while(c=='y');

break;

}

case '1': //增加数据

{

char name[20];

int number;double cpro,english,math,sport,law,hbpro,computer;

char c;

do

{

cout<

cin>>name;

cout<

cin>>number;

cout<

cin>>cpro;

cout<

cin>>english;

cout<

cin>>math;

cout<

cin>>sport;

cout<

cin>>law;

cout<

cin>>hbpro;

cout<

cin>>computer;

cout<

file[j]=new ofstream("d:\\document",ios::ate);

*file[j]<

"<

"<

数据库成绩 "<

j++;

s[i]=new student(name, number,

cpro,english,math,sport,law,hbpro,computer);

i++;

cout<

cin>>c;

cout<

if(c!='y'&&c!='n')

{

cout<

cin>>c;

}

}while(c=='y');

break;

}

case '2': //修改数据

{

char name[20];int nu;double cc,eng,ma,sp,l,hb,com;flag=0;

char c;

if(i==0)

{

cout<

}

do

{

cout<

cin>>name;

cout<

for(int h=0;h

if(strcmp(name,s[h]->name)==0)

{

flag=1;

cout<

cin>>nu;

cout<

cin>>cc;

cout<

cin>>eng;

cout<

cin>>ma;

cout<

cin>>sp;

cout<

cin>>l;

cout<

cin>>hb;

cout<

cin>>com;

cout<

s[h]->cpro=cc;

s[h]->english=eng;

s[h]->math=ma;

s[h]->sport=sp;

s[h]->law=l;

s[h]->hbpro=hb;

s[h]->computer=com;

s[h]->number=nu;

cout<

}

}

if(flag==0) {

cout<

}

cout<

cin>>c;

cout<

if(c!='y'&&c!='n')

{

cout<

cin>>c;

}

}while(c=='y');

break;

}

case '3': //按姓名查询

{

char n[20];int j=0;char c;

if(i==0)

{

cout<

}

do{

int flag=0;

cout<

cin>>n;

cout<

for(int j=0;j

{

if(strcmp(n,(*s[j]).name)==0)

{

flag=1;

cout<

cout<

}

}

if(flag==0)

cout<

cout<

cin>>c;

cout<

if(c!='y'&&c!='n')

{

cout<

cin>>c;

}

}

while(c=='y');

break;

}

case '4': //按学号查询

{

int n,j=0;char c;

if(i==0){

cout<

}

do{

int flag=0;

cout<

cin>>n;

cout<

for(int j=0;j

{

if(s[j]->number==n)

{

flag=1;

cout<

}

}

if(flag==0)

cout<

cout<

cin>>c;

cout<

if(c!='y'&&c!='n'

) {

cout<

cin>>c;

}

}

while(c=='y');

break;

}

case '5': //输出

{

cout<

if(i==0)

cout<

cout<

for(int k=0;k

{

cout<name<number<

<

<

}

break; }

case'6'://退出

{exit(0); cout<

}

cout<

int flag=0;

do

{

cin>>w;

cout<

if(w!='y'&&w!='n')

cout<

else

flag=1;

}while(flag==0);

if(w=='y')

cout<

cout<

cout<

cout<

cout<

cout<

cout<>p;

}while(w=='y');

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值