C语言实验——求三个整数的最大值

来源:互联网 发布:php ... 可变参数 编辑:程序博客网 时间:2024/05/21 17:09

Problem Description
请编写程序,输入三个整数,求出其中的最大值输出。
Input
在一行上输入三个整数,整数间用逗号分隔。
Output
输出三个数中的最大值。
Example Input
5,7,9
Example Output
max=9

#include <iostream>#include <cstdio>using namespace std;int main(){    int a,b,c;    scanf("%d,%d,%d",&a,&b,&c);    //cin>>a>>",">>b>>",">>c;查询c++怎么输入    int max=a;    if(max<b)        max=b;    if(max<c)//不能用else if。        max=c;    cout<<"max="<<max<<endl;    return 0;}
原创粉丝点击