1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
#include <iostream>#include <fstream>#include <iomanip>#include <string>#include <conio.h>using namespace std; int ReadArrays(string, names[], int totals[]); int main(){ string names[50]; int totals[50], count; count = ReadArrays(names,totals); //SortArrays(names,totals,count); //PrintArrays(names,totals,count); getch(); return 0;} int ReadArrays(string, names[], int totals[]){ ifstream StudentFile; names[]; int test1, test2, test3; while(getline(StudentFile,names[])) { StudentFile >> test1; StudentFile >> test2; StudentFile >> test3; StudentFile.ignore(10,'\n'); }}#include <iostream>
#include <fstream>
#include <iomanip>
#include <string>
#include <conio.h>
using namespace std;
int ReadArrays(string, names[], int totals[]);
int main()
{
string names[50];
int totals[50], count;
count = ReadArrays(names,totals);
//SortArrays(names,totals,count);
//PrintArrays(names,totals,count);
getch();
return 0;
}
int ReadArrays(string, names[], int totals[])
{
ifstream StudentFile;
names[];
int test1, test2, test3;
while(getline(StudentFile,names[]))
{
StudentFile >> test1;
StudentFile >> test2;
StudentFile >> test3;
StudentFile.ignore(10,'\n');
}
}
|