#include <iostream>
usingnamespace std;
int returnthis (int a; int b;) {
return a + b;
}
int main ()
{
int returnedint, a, b;
cout << "Enter a number: \n";
cin >> a;
cout << "Enter a number: \n";
cin >> b;
returnedint = returnthis(a,b);
cout << "Result: " << returnedint;
return;
}
When I try to build in MS visual C++ express, I get the following errors:
1>MyFirstCplusplusFunction.cpp(2): warning C4627: '#include <iostream>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>MyFirstCplusplusFunction.cpp(21): fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "StdAfx.h"' to your source?
Oh thank you, I did not know you could do that. I eventually followed the compilers reccomendation in the error window, and added "stdafx.h" which fixed my problem.