Program that finds the smallest integer
How would you go about writing a C++ program that finds the smaller of two integers input using an if statement?
It's a very easy question. Take as input two integers, and then confront them, you can have three situations, a>b, a=b, b>a
cout << "Give me two numbers: ";
cin >> a >> b;
cout << "The smaller is " << b;
cout << "The smaller is " << a;
cout << "They have the same value";
Last edited on
Topic archived. No new replies allowed.