File --> array(s) --> cout output!

Plz help! Im trying to read a list of (2 sets of "int", 2 sets of strings, and 5 sets of floats) all in one file than place them into an array than cout them.! HELP!!

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
39
40
41
42
43
 #include <iostream>
#include <string>
#include <iomanip>
#include <cmath>
#include <cstdlib>
#include <fstream>
using namespace std;


int main(){
	const int size =10;
	int no [10];
	int STD [10];
	string fname [10];
	string lname [10];
	int cch [10];
	float cgpa1 [10];
	float cgpa2 [10];
	float cgpa3 [10];
	float cgpa4 [10];
	float cgpa5 [10];	ifstream fin;
	


	fin.open("sdent.txt");
	for(int i=0;i<size; ++i){
		fin>> no[i]>>STD[i]>>fname[i]>> lname[i]>>cch[i]>>cgpa1[i]>>cgpa2[i]>>cgpa3[i]>>cgpa4[i]>>cgpa5[i];	
	
		cout << no[i]<<STD[i]<<fname[i]<< lname[i]<<cch[i]<<cgpa1[i]<<cgpa2[i]<<cgpa3[i]<<cgpa4[i]<<cgpa5[i]<< endl;}












	return 0;
}
Topic archived. No new replies allowed.