Novice needs help with Functions
Hi guys,
First of all, I'm newto this board, so nice to meet you!
Well, now that introductions are over:
I'm a super fresh newbie to C++, and I'm having a hell of a time with fucntions. Basically, I'm trying to write an elementary program that passes variables into a function--the function then adds the variable and sends the results back into the prgram. Here is the code:
Code:
#include <iostream>
int myFunc(int x, int y);
int main()
{
int a;
int b;
int c;
std :: cout << "Enter a number \n";
std :: cin >> a;
std :: cout << "Enter another number \n";
std :: cin >> b;
myFunc();
std:: cout << "myFunc is: " << c;
return 0;
}
int myFunc (a,b)
{
c = a + b;
return c;
}
For some reason, I get nothing but compiler errors when I try to run it. I've declared that the function will accept integers, and have listed that it will return integer values. I have no idea what I'm doing wrong. I know you guys have better things to do--and better problems to work on--but I really need some help. Any advice, or should I just hang my head in shame?