Need help with this problem.
I'm having pretty big problems with these class assignments.. Could someone please help me? It's killing me..
Change the following program to pass two parameters to the function multiply and return a result from it. Make the global variables local to main.
Code:
#include <iostream>
#include <string>
using namespace std;
// the following line is your function template
// change it as needed
void multiply();
// the following two lines are global variables.
// Make them local to main and pass them back and
// forth to/from the function multiply
int x, y; // global values that pass values in
int result; // global value that returns the result
int main ()
{
cout << "Enter two numbers\n";
cin >> x >> y;
multiply();
cout << "The product is " << result << endl << endl;
system ("PAUSE");
return 0;
}
void multiply()
{
result = x * y;
return;
}