#include
void main
{
char n1,n2,n3,max;
scanf(“%c%c%c”清缓带&n1,&n2,&n3);
max=n1>n2?n1:n2;
printf(“哪洞%c\n”,max);
}
注意:C语言中的标点符号都需要为英文中的标点符号。
扩展资料:
使用其他的方法得到3个数的最大值:
#include
using namespace std;
int main( )
{
int a1, a2, a3;
cout << "请分别输入三个整数:" << endl;
cout << "a1 = ";
cin >> a1;
cout << "a2 = ";
cin >>答芦 a2;
cout << "a3 = ";
cin >> a3;
cout << "利用条件表达式找出三个数的最大值为:";
cout << (a1 >= a2 ? a1 >= a3 ? a1 : a3 : a2 >= a3 ? a2 : a3) << endl;
}
程序如缺颂下,望楼主采纳:
#include
using namespace std;
float maxNum(float,float,float);
int main()
{
float x,y,z;
cout<<"请依次输入三个数:"<
float maxN = maxNum(x,y,z);
cout<<"最大值是:"<
float maxNum(float a,float b,float c)//求银扮租三个数中的锋兆最大值
{
if(a>=b && a>=c)
return a;
else if(b>=c)
return b;
else return c;
}
#include
using std::cin;
using std::cout;
using std::endl;
int main(){
int a,b,c;
cout<<"请任意输入第一个腊让山数:"<
cout<<"请任意输入第二个数:"<
cout<轮中<"滑吵请任=意输入第三个数:"<
int max=a;
if(b>=max)max=b;
if(c>=max) max=c;
cout<<"最大的数是:";
cout<
}
#include
using namespace std;
#define max(a,b) (((a) > (b)) ? (a) : (b))
int main()
{
double threemax(double m1,double m2,double m3);
double a1,a2,a3;
cout<<"input three number:"<
cout<<"the max of three number"<
return 0;
}
double threemax(double m1,double m2,double m3)
{
double t;
return max(t,m3);
t = max(m1,m2);
}
#include
#include
using namespace std;
int main(void)
{
int a[3];
while(cin>>a[0]>御举虚>a[1]>答答>a[2])
{
sort(a,a+3);
cout<<"The maximum number is : "<cout<<"The minimum number is : "<}
return 0;
}