#include <cstdlib>
#include <iostream>

#include "stdafx.h"
using namespace std;

int main()
{
    
    char YorN;
    cout << "This Program Calculates Job Earnings\n\n";
    cout << "Would You Like To Use The Pay Calculator Program: ";
    
    //With while loop the 2 previous cout statements are not
    //read
    
    cin >> YorN;
    
    while ( YorN == 'Y' || YorN == 'y' )
    
    {  
         //while ( YorN <> 'N' || YorN <> 'n' )
          cout << "Would You Like To Enter The Program Again";
          cin  >> YorN;
    }
    
    system("PAUSE");
    return 0;
}

i ran this program before and i didn't have any problems no when i run this program i keep getting these errors.

Warning 1 warning C4627: '#include <cstdlib>': skipped when looking for precompiled header use d:\windows\my documents\visual studio 2008\projects\yornloop.with.while.and.y.equal.loop.no\yornloop.with.while.and.y.equal.loop.no\yornloop.with.while.and.y.equal.loop.no.cpp 1 YorNLoop.with.while.and.y.equal.loop.no


Warning 2 warning C4627: '#include <iostream>': skipped when looking for precompiled header use d:\windows\my documents\visual studio 2008\projects\yornloop.with.while.and.y.equal.loop.no\yornloop.with.while.and.y.equal.loop.no\yornloop.with.while.and.y.equal.loop.no.cpp 2 YorNLoop.with.while.and.y.equal.loop.no


Error 3 error C2871: 'std' : a namespace with this name does not exist d:\windows\my documents\visual studio 2008\projects\yornloop.with.while.and.y.equal.loop.no\yornloop.with.while.and.y.equal.loop.no\yornloop.with.while.and.y.equal.loop.no.cpp 5 YorNLoop.with.while.and.y.equal.loop.no


Error 4 error C2065: 'cout' : undeclared identifier d:\windows\my documents\visual studio 2008\projects\yornloop.with.while.and.y.equal.loop.no\yornloop.with.while.and.y.equal.loop.no\yornloop.with.while.and.y.equal.loop.no.cpp 11 YorNLoop.with.while.and.y.equal.loop.no

Recommended Answers

All 2 Replies

You are using a Microsoft compiler, and it creates projects that, by default, use precompiled headers. If you want to use precompiled headers then the very first include file must be stdafx.h

#include "stdafx.h"
// other stuff here

If you don't want to use precompiled headers then go to Project --> Project --> C++ tab --> Precompiled Headers and turn them off. (Assuming VC++ 2005/2008 compiler)

If you don't want to use precompiled headers then go to Project --> Project --> C++ tab --> Precompiled Headers and turn them off. (Assuming VC++ 2005/2008 compiler)

And when creating a new project, be sure you're selecting a Win32 Console application, and on the Application Wizard you go to the second tab (Application Settings) where you check Empty Project.

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.