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;


}

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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.