Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as C++ by gary11204 ( 14 years ago )
#include <iostream>
#include <string>
#include <stdlib.h>
#include <fstream>
using namespace std;
int main(){
ifstream infile("stu.txt");
string input;
string *data[100];
string *number[100];
string *name[100];
int chinese[100];
int english[100];
int math[100];
float average[100];
int count = 0;
while( infile ){
/* data[count] = new string( input ); */
if( count == 0 ){
count++;
continue;
}
infile >> number[count] >> name[count] >> chinese[count] >> english[count] >> math[count];
count++;
}
for(int i=1;i < count;++i){
average[i] = (chinese[i] + english[i] + math[i])/3;
}
for(int i=0;i< count;++i){
if(i == 0)
cout << *(data[i]) << " 平均" << endl;
else
cout << *(number[i]) << *(name[i]) << chinese[i] << english[i] << math[i] << endl;
}
system("pause");
return 0;
}
Revise this Paste
Children: 46791