I get this result from my code. Whats wrong?
:S
i dont get it
Please insert the first number you would like to use
54
And the second number u would like to use
90
What would u like to do? +(1) *(2) eller -(3) ?: 2
your answer is:-1076632888your answer is:4860your answer is:4860dominoeffekt@ubuntu:~/codes$
#include <iostream>
usingnamespace std;
int add(int firstnumber,int secondnumber)
{
return(firstnumber+secondnumber);
}
int multi(int firstnumber,int secondnumber)
{
return(firstnumber*secondnumber);
}
int sub(int firstnumber,int secondnumber)
{
return(firstnumber-secondnumber);
}
int main()
{
int a,b,c;
int what;
cout << "Please insert the first number you would like to use" << endl;
cin >> a;
cout << "And the second number u would like to use" << endl;
cin >> b;
cout << "What would u like to do? +(1) *(2) eller -(3) ?";
cin >> what;
if (what == 1)
c=add(a,b);
cout << "your answer is:" << c;
if (what == 2)
c=multi(a,b);
cout << "your answer is:" << c;
if (what == 3)
c=sub(a,b);
cout << "your answer is:" << c;
return (0);
}