0

I am currently learnning c++ from a text book. but I have come accross an error when trying to run the program.
The error reads like this:

fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "StdAfx.h"' to your source code?

My code reads:

include <iostream>

include <string>

using namespace std;

int main()

{


string username;
string password;
bool success;

cout<<"\tGame Designer's Network\n"<<endl;

    do
    {
        cout<<"Username: "<<endl;
        cin>>username;

        cout<<"Password: "<<endl;
        cin>>password;

        if (username == "Naughty Dog" && password == "Uncharted")
        {
            cout<<"Hey, Drake\n"<<endl;
            success=true;
        }
        else if (username == "Nintendo" && password == "Mario Bros")

        {
            cout<<"Oh mama mia, it's luigi.\n"<<endl;
            success=true;
        }
        else if (username == "Bongie" && password == "Halo")
        {
            cout<<"Welcome, Master Cheif.\n"<<endl;
            success= true;
        } 
        else if (username == "gues" || password == "guest")
        {
            cout<<"Welcome, guest.\n"<<endl;
            success= true;
        }
        else
        {
            cout<<"invalid password or username, plaese try again.";
            success=false;
        }
    } while (!success);
    return 0;


}
2
Contributors
2
Replies
11
Views
3 Years
Discussion Span
Last Post by luis.baez.9216
1

what compiler are you using? if you are using msvc++ you have to pick a win32 console application.

0

Thank you, I had apparently picked something else. The program is now running without the error.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.