C#从键盘输入两个整数 输出最大值和最小值 static void Main(string[]args){Console.WriteLine(\"请输入数字a:\");int a=Convert.ToInt32(Console.ReadLine());Console.WriteLine(\"请输入数字b:\");int b=Convert.ToInt32(Console.ReadLine());Console.WriteLine(\"数值a:\"+a);Console.WriteLine(\"数值b:\"+b);Console.WriteLine(\"最大值:{0},最小值:{1}\",Math.Max(a,b),Math.Min(a,b));Console.ReadLine();}
C语言的题。从键盘前输入两个整数,输出较大的数! #includevoid main(){int a,b;printf(\"请输入两个整数:抄\\n\");scanf(\"%d\",&a);scanf(\"%d\",&b);printf(\"较大的数是:%d\",a>;b?a:b);这一句也可zd这么写if(a>;b)printf(\"较大的数是:%d\",a);else printf(\"较大的数是:%d\",b);}
从键盘输入两个超长的正整数a,b,求(a+b)和(a-b)的精确值,显示计算结果。设输入数据的最大长度不超过70位 #includeincludeincludeincludeincludeusing namespace std;inline int max(int a,int b){return a>;b?a:b;}class LONG{public:static const int size=1000,base=10;int len,num[size];len存储位长,num[i]存储第i位的值bool flag;true=,false=-friend int cmp(LONG&a,LONG&b);必须加friend,否则编译器以为cmp为内部函数LONG(){len=1;flag=true;memset(num,0,sizeof(num));}bool iszero(){return len=1&num[0]=0;}LONG(char*s){/以char类表示的数值转换为 LONG类;注意基都是base,并且s必须以'\\0'结尾,因为要用到strlen()函数memset(num,0,sizeof(num));int i;len=strlen(s);for(i=0;i;i+)num[i]=s[len-i-1]-'0';while(len>;0&num[len-1]=0)len-;if(len=0)len+;if(len>;1&(s[0]='-'|s[0]='+')){len-;num[len]=0;}if(s[0]='-')flag=false;else flag=true;}void print(int k=0){/输出int i;if(k。0&flag)printf(\"+\");if。flag)printf(\"-\");printf(\"%d\",num[len-1]);for(i=len-2;i>;=0;i-)printf(\"%d\",num[i]);}LONG operator+(LONG&b){LONG operator-(LONG&b);if((flag^b.flag)=true){if(b.flag=false){LONG c(b);c.flag=true;c=*this-c;。