Answer to Question #19348 in C++ for alaa

Question #19348
Write a C++ program that prompts the user to enter three integers. The program should out put the largest one
1
Expert's answer
2012-11-26T05:31:22-0500
#include<iostream>
using namespace std;
int main ()
{
int num1, num2, num3;
cout << "Enter 1 number: " << endl;
cin >> num1;
cout << "Enter 2 number: " << endl;
cin >> num2;
cout << "Enter 3 number: " << endl;
cin >> num3;

int largest = num1;
if (num2 > largest) {
& largest = num2;
}
if& (num3 > largest) {
& largest = num3;
}

cout << "Largest number: " << largest << endl;
system ("pause");
return 0;

}


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS