برنامه ای بنویسید که 10 عدد از ورودی گرفته دو عددی که از همه بزرگ تر هست را نمابش دهد.
#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
int counter = 0, number, largest, secondLargest = 0;
cout << "Enter the first number: ";
cin >> largest;
while ( ++counter < 10 )
{
cout << "Enter next number: ";
cin >> number;
if( number > largest ) {
secondLargest = largest;
largest = number;
}
else if ( number > secondLargest )
secondLargest = number;
}cout << "\nLargest is " << largest
<< "\nSecond largest is " << secondLargest << endl;
getch();
return 0;
}