How could I use cin
to insert values for the function?
cin >> addNumber();
cout << addNumber() << endl;
I am not
#include <iostream>
using namespace std;
int addNumber(int x, int y)
{
int answer = x + y;
return answer;
}
int main()
{
int x,y;
cout<<"Enter first number"<<endl;
cin>>x;
cout<<"Enter second number"<<endl;
cin>>y;
cout<<addNumber(x,y)<<endl;
return 0;
}
#include <iostream>
int addNumber(int x, int y)
{
int answer = x + y;
return answer;
}
int main()
{
int x,y;
std::cin >> x >> y;
std::cout << addNumber(x,y) << std::endl;
return 0;
}