looking at this quickly. one issue is you can only return one value per function. Unless this is some sort of recursive return that I am not seeing... Maybe I am wrong, but that is what is jumping out at me.
EDIT:
Also I believe it is better practice to declare your constants outside (above) of main. Maybe your function prototype takes care of that, but to me it seems a little confusing.
Its is also not clear (from your comments - to me at least so no offense ) what calculation your performing.
char answer = 'y';
/...
.../
cout<< "would you like to try another?";
cin >> answer;
// you should use a do - while loop () here,, before return 0;
return 0;
something like this:
1 2 3 4 5 6 7 8 9
do {
/... your code
... /
cout<< "would you like to try another?";
cin >> answer;
} while ( answer == 'y' );
return 0;
#include <iostream>
usingnamespace std;
int myfunction(int foo, int bar );
int main( )
{
int var1, var2;
cout << "Enter a number: " << endl;
cin >> var1;
cout << "Enter a number: " << endl;
cin >> var2;
int result;
result = myfunction(var1, var2);
return 0;
}
int myfunction(int foo, int bar ){
int return_value;
return_value = foo + bar;
return return_value;
}