![](https://csdnimg.cn/release/download_crawler_static/86330456/bg3.jpg)
3
//找出5个数中的最大值
void main( )
{
int a1,a2,a3,a4,a5;
cout<<“Input the number:”;
cin>>a1>>a2>>a3>>a4>>a5;
if(a1>a2&&a1>a3 && a1>a4 && a1>a5)
cout<<“The max_number is”<<a1;
else if(a2>a3 && a2>a4 && a2>a5)
cout<<“The max_number is”<<a2;
else if(a3>a4 && a3>a5)
cout<<“The max_number is”<<a3;
else if(a4>a5)
cout<<“The max_number is”<<a4;
else cout<<“The max_number is”<<a5;
}
问题的引出
编程实现:在5位同学中找出‚计
算机程序设计‛成绩最好的同学。
当 n=10
n=100
n=1000
评论0