Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void listStudents(){
- cout << endl << "List students" << endl<< endl;
- ifstream textfile;
- string line;
- string unused = "";
- textfile.open("students.txt");
- if(textfile.is_open()){
- int count = 0;
- for(int i = 0 , j = 0; !textfile.eof(); i++){
- if(i == j){
- count++;
- textfile >> line;
- cout << count << ": " << line;
- textfile >> line;
- cout << " " << line << endl;
- j+=11;
- }else{
- textfile >> unused;
- unused = "";
- }
- }
- }else{
- cout << "You don't have any students!" << endl;
- }
- textfile.close();
- cout << endl << endl;
- main();
- }
- !textfile.eof()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement