reading file(loop) with a blank space in it
My code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
#include <fstream>
#include <iostream>
using namespace std;
int main(){
ifstream fin;
fin.open("students.txt");
char person[50];
double number;
while(!fin.eof()){
fin.getline(person, 50);
fin >> number;
cout<< person << endl;
cout<< number << endl;
}
fin.close();
return 0;
}
| |
students. txt:
Person One
56.09
Second Person
98.44
and so on with the same format |
Rules:
every time double is read, the double input is multiplied by 1.10
example output:
Person One
61.69
Second Person
108.284 |
it doesnt work.
can anyone help me?
Last edited on
Topic archived. No new replies allowed.