yahooanswersgirl
New member
- Oct 7, 2011
- 0
- 0
- 0
C++ Convert program to input from file C++ Class?
A teacher has asked all her students to line up single file alphabetically according to their first name. For example, in one class Amy will be at the front of the line and Yolanda will be at the end. Write a program that prompts the user to enter the number of students in the class, then loops to read in that many names. Once all the names have been read in it reports which student would be at the front of the line and which one would be at the end of the line. You many assume that no two students have the same name. Validation: Do not accept a number less than 1 or greater than 25 for the number of students. http://pastebin.com/raw.php?i=BJYVWy6N This works correctly.
**** Part two re-write the file get names from a file instead of inputting them one by one. Names should read until there is no more data to read (instead of 1-25).
http://pastebin.com/95sNdjeD This is what I have so far. I'm not sure if I even need a count for it to work, I'm really stuck. I've even tried infile and testing it. I'm aggravated because we haven't covered this, nor is there much in the book, and my teacher has assigned it anyways.
Here is the text file info for easy testing. http://pastebin.com/raw.php?i=msS6fYH9
I need help with part two only.....
I need someone to compile and test if they can get a correct output and find where the error is and quote the error in code with the fix?
I can paste the code, but since this is common homework for C++ I figured it'd be better in pastebin with and expiration date.
A teacher has asked all her students to line up single file alphabetically according to their first name. For example, in one class Amy will be at the front of the line and Yolanda will be at the end. Write a program that prompts the user to enter the number of students in the class, then loops to read in that many names. Once all the names have been read in it reports which student would be at the front of the line and which one would be at the end of the line. You many assume that no two students have the same name. Validation: Do not accept a number less than 1 or greater than 25 for the number of students. http://pastebin.com/raw.php?i=BJYVWy6N This works correctly.
**** Part two re-write the file get names from a file instead of inputting them one by one. Names should read until there is no more data to read (instead of 1-25).
http://pastebin.com/95sNdjeD This is what I have so far. I'm not sure if I even need a count for it to work, I'm really stuck. I've even tried infile and testing it. I'm aggravated because we haven't covered this, nor is there much in the book, and my teacher has assigned it anyways.
Here is the text file info for easy testing. http://pastebin.com/raw.php?i=msS6fYH9
I need help with part two only.....
I need someone to compile and test if they can get a correct output and find where the error is and quote the error in code with the fix?
I can paste the code, but since this is common homework for C++ I figured it'd be better in pastebin with and expiration date.