i'm trying use function
int input(int marks[classmax][3], string names[classmax], float& avg) { (int = 0; < students; i++) { (int j = 0; j < 3; j++) { fin >> marks[i][j]; } fin >> names[i]; } }
to list of marks student names 2 arrays. list follows: m1 m2 m3 firstname lastname
, m means mark. loop working fine when reaches space between first , last name program seems write firstname array. tried using fin.get
, fin.getline()
i'm getting error:
error: no matching function call 'std::basic_ifstream<char>::get(std::strings&, int)'
you can try this:
int input(int marks[classmax][3], string names[classmax], float& avg) { (int = 0; i<students; i++) { (int j = 0; j<3; j++) { fin >> marks[i][j]; } std::getline(fin, names[i]); } }
for more information check out cppreference.
Comments
Post a Comment