- #1
Teh
- 47
- 0
What is wrong with my program. I am so close!
Define stubs for the functions called by the below main(). Each stub should print "FIXME: Finish FunctionName()" followed by a newline, and should return -1. Example output:
output:
main.cpp: In function ‘int main()’:
main.cpp:42:45: error: too many arguments to function ‘int ComputeAvg()’
main.cpp:27:5: note: declared here
Define stubs for the functions called by the below main(). Each stub should print "FIXME: Finish FunctionName()" followed by a newline, and should return -1. Example output:
Code:
FIXME: Finish GetUserNum()
FIXME: Finish GetUserNum()
FIXME: Finish ComputeAvg()
Avg: -1
#include <iostream>
using namespace std;
/* Your solution goes here */
int GetUserNum();
int ComputeAvg();
int FunctionName(int argc, char ** v )
{
GetUserNum();
ComputeAvg();
return 0;
}
int GetUserNum()
{
cout << "FIXME: Finish GetUserNum()" << endl;
return -1;
}
int ComputeAvg()
{
cout << "FIXME: Finish ComputeAvg()" << endl;
return -1;
}
/* my solution ^ ^ ^ */
int main() {
int userNum1 = 0;
int userNum2 = 0;
int avgResult = 0;
userNum1 = GetUserNum();
userNum2 = GetUserNum();
avgResult = ComputeAvg(userNum1, userNum2);
cout << "Avg: " << avgResult << endl;
return 0;
}
main.cpp: In function ‘int main()’:
main.cpp:42:45: error: too many arguments to function ‘int ComputeAvg()’
main.cpp:27:5: note: declared here