MS Visual C++ error C2065: 'highS' : undeclared identifer RRS feed

  • Question

  • I am making a scoring system for a game but I am having trouble. I get this error: error C2065: 'highS' : undeclared identifier. I am using the info from this tutorial   and even though I am doing it pretty much the same I get this error. I have made a file called highscores.txt in the correct folder but if you want to know it looks like this: 

    0 empty
    0 empty
    0 empty

    Here is my game code:

    void load();
    void Nscore();
    void display();
    int HS[3];
    string HSN[3];
    int score;
    void main()
    	ifstream highS("highscores.txt");
    void Nscore(){
    	cout << "Enter a new score" << endl;
    	cin >> score;
    void load(){
    	int hs;
    	string hsn;
    	for(int x = 0; x < 3; x++){
    		while(highS >> hs >> hsn){
    			cout << endl;
    void display(){

    I would really like to get this figured out. Also if anyone could point me to a good tutorial for C++ file management I would appreciate it a lot. Thank you. 

    Thursday, April 10, 2014 1:23 AM

All replies