Okay. So I posted a couple of nights ago, asking how to reset the values from a file (here's the link: Please Help?). I think I'm on the right track, but I'm not sure. Here's the code:
Code:
/*
Reset
by
Your Name
Used to reset the high scores from the High_Score.txt file
*/
// Include the libraries
#include <iostream>
#include <string>
#include <fstream>
// Use the standard namespace
using namespace std;
void main ( )
{
//Declare local variables
int High_Score[5];
string High_Score_Name[5];
char User_Input;
// Input the high scores from a file
ifstream Input_High_Scores;
Input_High_Scores.open("High_Scores.txt");
for (int i = 0; i < 5; i++)
{
Input_High_Scores >> High_Score[i];
Input_High_Scores >> High_Score_Name[i];
}
Input_High_Scores.close ();
// Give output to user
cout << "Would you like to reset the high scores? Y for yes, N for no." << endl;
cin >> User_Input;
// Output the high scores to a file
ofstream Output_High_Scores;
Output_High_Scores.open ("High_Scores.txt");
if (User_Input == 'Y' || 'y')
{
High_Score[0] = 25000;
High_Score[1] = 12000;
High_Score[2] = 7500;
High_Score[3] = 4000;
High_Score[4] = 2000;
High_Score_Name[0] = "Gwyneth";
High_Score_Name[1] = "Adam";
High_Score_Name[2] = "Nastasia";
High_Score_Name[3] = "Nicolas";
High_Score_Name[4] = "Dani";
}
Output_High_Scores.close ( );
for (int i = 0; i < 5; i++)
{
cout << High_Score[i] << " " << High_Score_Name[i] << endl;
}
system ("PAUSE");
}
However, when I try and debug, I get an error:
MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup
How can I fix this, and am I on the right track to making it work?