Hi, everyone. So my professor gave the class an assignment and what it had to do is basically have the compiler say:
Enter two numbers: x y
x "plus" y "equals: "
using a function and int main.
and we could not use any cout in the function.
how can i get it to print out the added numbers in the function from int main?
what i have is:
#include <iostream>
using namespace std;
int x = 0;
int y = 0;
void add()
{
x+y;
}
int main()
{
cout << "Enter two numbers: ";
cin >> x;
cin >> y;
cout << x << " plus " << y << " equals: ";
add();
cout << "\n";
return 0;
}
when i call the function it will not print out from int main though. thanks a lot.