Hi guys. I know you probably get this error a lot here but i cannot figure this out for the life of me. Here is the code i have written:
#include <iostream>
#include "stdafx.h"
using namespace std;
int main();
{
int c, thisIsAVariable, q76354, number;
cout << "Enter an integer: ";
cin >> age;
if (age != 7)
cout << "the variable number is not equal to 7" << endl;
cout << "This is a C++ program" << endl;
cout << "This is a C++ \n program" << endl;
cout << "This\nis\na\nC++\nprogram" << endl;
cout << "This\tis\ta\tC++\tprogram" << endl;
What is the actual error message? What line is it on?
EDIT:
actually it's probably due to stdafx. precompiled headers have to be the very first thing included.
Solutions:
1) turn off precompiled headers. They're stupid for these small projects. (when you make a new project in visual studio, be sure to check the "empty project" checkbox in the wizard)
or
2) Move #include "stdafx.h" so that it is above #include <iostream>