Hey =)
It's kind of right, the only problem is that the function is declared after the main and when it's read in main, it doesn't know yet that the function exists. Two solutions:
Put the function before main:
# include <iostream>
using namespace std;
void testFunction ()
{
cout << "Hello 2!\n";
}
int main()
{
cout << "Hello!\n";
testFunction ();
cout << "Your back!\n";
char f;
cin >> f;
return 0;
}
Or, create a prototype of the function:
# include <iostream>
using namespace std;
void testFunction();
int main()
{
cout << "Hello!\n";
testFunction ();
cout << "Your back!\n";
char f;
cin >> f;
return 0;
}
void testFunction()
{
cout << "Hello 2!\n";
}
Hope that helped :)