I've been looking all over online and have no idea what the instructor means, and he doesn't like replying until 4-5 days later. Very quick and brief overview of the project: -Create three files in Putty Unix, (main.cpp - provided by instructor, functions.cpp, functions.h) -Purpose: calculate average of 2 integers input by user, lists GCM, lists LCM
I'm most likely fine with GCM and LCM, but the average part is what I'm stuck on. Instructions said to uncomment the call to doAverage() in main. There is no doAverage() in the main.cpp he provided though, and I've tried removing the doAverage under case 3, and program still does not work. Am I missing something?
main.cpp code:
#include <iostream>
#include "functions.h"
using namespace std;
void getValues(int& x,int& y) {
cout << "Enter the first integer: ";
cin >> x;
cout << "Enter the second integer: ";
cin >> y;
}
int main() {
int choice;
bool done = false;
int x,y;
cout << "Welcome to the math functionator!" << endl << endl;
do {
cout << "1) GCD" << endl;
cout << "2) LCM" << endl;
cout << "3) average" << endl;
cout << "0) quit" << endl;
cout << "Enter choice: ";
cin >> choice;
if (choice != 0) {
getValues(x,y);
}
switch (choice) {
case 1:
//doGCD(x,y);
break;
case 2:
//doLCM(x,y);
break;
case 3:
case 0:
done = true;
}
} while (!done);
cout << "Bye" << endl;
return(0);
}
functions.cpp code:
#include <iostream>
using namespace std;
void doAverage(int x, int y);
{
int sum = x+y;
int average = sum/2;
cout << "Average of " << x << " and " << y << " is " << average << endl;
}
functions.h code:
void doAverage(int x, int y);
The main.cpp was provided by the instructor, and the code from functions.cpp as well as functions.h is also provided from instructor. Instructions said to uncomment doAverage from main, but I thought you only uncomment if there are # or ./, etc...