Q:

Using the IO library, we can extend our main program to prompt the user to give us two numbers and then print their sum

0

Using the IO library, we can extend our main program to prompt the user
to give us two numbers and then print their sum.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#include <iostream>
int main()
{
std::cout << "Enter two numbers:" << std::endl;
int v1 = 0, v2 = 0;
std::cin >> v1 >> v2;
std::cout << "The sum of " << v1 << " and " << v2
<< " is " << v1 + v2 << std::endl;
return 0;
}

 

Output:

Enter two numbers:
3 7
The sum of 3 and 7 is 10

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now