getting lazy with adding up all my bowling scores and finding my average and everything.... Decided while I was at it, I might as well make a program that'll keep scores and averages for the entire league....
here's my first problem.... first, a menu comes up with the choice of entering a new bowler, adding scores, looking at the scores, etc.... this is the part for adding a new bowler.... planning on having the program keep a master list with all the bowler names.... each name will be linked to a file with the scores for that bowler.... this part creates and fills the master list.... my problem is, when I run this part, it opens the file, pulls the names out, adds the new bowler to the bottom of the array I have the list going into, and then puts them back into the file.... It then brings up the option to exit the program or return to the menu.... If I return to the menu and run the section to add another bowler new bowler, it erases the names in the file and adds the new one.... Adding a bowler, exiting, opening the program again and adding another bowler works fine, but that's a waste of time.... I might as well just open the file and type everyone's name in it.... Is there a way around this? I've been out of my c++ class for almost 2 years, always had problems with this kind of thing, though....Code:{ value = 0; MasterlistIn.open("Masterlist.txt"); getline(MasterlistIn, Master[value]); value++; while (MasterlistIn) { getline(MasterlistIn, Master[value]); value++; } control = value; MasterlistIn.close(); cout << "Create new bowler." << endl << endl << "Enter name of bowler." << endl << endl; cin >> bowler; cout << endl << endl; Master[value] = bowler; value = 0; MasterlistOut.open("Masterlist.txt"); for (value = 0; value < control - 1; value++) { MasterlistOut << Master[value] << endl; } MasterlistOut << bowler << endl; MasterlistOut.close(); system("cls");