0

I'm an absolute beginner and can't figure out why this program doesn't work.

I started going through the c++ primer 5th edition. It says to right this program. #include <iostream> using namespace std; int main() { std::cout << "Input two numbers." << endl; int v1=0, v2=0; std::cin >> v1 >> v2 >> std::endl; std::cout << "The product of the two numbers is: " << v1*v2 << endl; return 0; } Everytime I input this into the "C4 droid" app on my android it says there is a problem.

12th Oct 2018, 4:12 AM
josiah
3 odpowiedzi
+ 10
Change the 8th line to: std::cin >> v1 >> v2; For why it caused a compilation error, look here: http://www.enseignement.polytechnique.fr/informatique/INF478/docs/Cpp/en/cpp/io/manip/endl.html
12th Oct 2018, 10:27 AM
Harsh
Harsh - avatar
0
Try changing std::cin >> v1>>v2>>std::endl into std::cin >> v1>>v2
12th Oct 2018, 5:46 AM
Daniele Bonomi
Daniele Bonomi - avatar
0
problem solved. thank you.
12th Oct 2018, 1:36 PM
josiah