Cout gives error of undeclared identifier

This keeps on getting the error: "Undeclared identifier" even though I have the #include <iostream> on there. I realized that whenever I do not have the #include "stdafx.h" on there, the only error I get is that I need it. When I add it on there, the cout and cin are all considered error? How do I fix this?

#include <iostream>
#include <fstream>
#include <iomanip>
#include "stdafx.h" //Error when used for cout and cin

using namespace std;

class student
{
int studentnum;
public:
void getdata(); //Function to accept data from user
};

void student::getdata()
{
cout << "Enter student number (3 digits): ";
cin >> studentnum;
}
Turn off precompiler headers and do not include "stdafx.h".

http://stackoverflow.com/a/7261771
Topic archived. No new replies allowed.