从键盘输入3个整数,并显示其中最大的整数。
来源:百度知道 编辑:UC知道 时间:2024/05/22 07:05:45
恩
给你个c++的
#include <iostream>
using namespace std;
int max (int x,int y)
{
int z;
if (x>y) z=x;else z=y;
return z;
}
int main()
{
cout<<"请输入三个数据:";
int a,b,c,m;
cin>>a>>b>>c;
m=max(a,b);
m=max(m,c);
cout<<"这三个数中最大的是:"<<m<<endl;
system("pause");
return 0;
}
#include<iostream>
using namespace std;
int main()
{
float a,b,c;
cin>>a>>b>>c;
cout<<((a>b?a:b)>c?(a>b?a:b):c);
return 0;
}
给你写个C语言写的
#include <stdio.h>
main()
{
int a , b , c , max;
printf("Please enter data!");
scanf("%d %d %d",&a,&b,&c);
max=(a>b?a:b);
printf("max is %d",(max>c?max:c));
}
你要什么语言来写哇?