c语言程序如何生成软件,用c语言编写的程序怎么样生成可执行软件。
呵呵,很簡單的問題呀,我這里有四種方法,你參考一下
#include
void main()
{
int a,b,c,max; //這里只能為整形,不能為double型
printf("please input three number a,b,c:\n");
scanf("%d%d%d",&a,&b,&c);
// method one:
max=a;
if(b>=max) max=b;
if(c>=max) max=c;
printf("the max is:%d\n",max);
// method two:
if(a>=b&&a>=c)
printf("the max is %d\n",a);
else if(b>=a&&b>=c)
printf("the max is %d\n",b);
else
printf("the max is %d\n",c);
// method three:
printf("the max is: %d\n",a>=b&&a>=c?a:(b>=a&&b>=c?b:c));
// method four:
int a[3],max=-32768;
for(int i=0;i<3;i++)
{
scanf("%d",&a[i]);
if(a[i]>max) max=a[i];
}
printf("the max is:%d\n",max);
}
取消
評論
總結
以上是生活随笔為你收集整理的c语言程序如何生成软件,用c语言编写的程序怎么样生成可执行软件。的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: js IE和Firefox下event处
- 下一篇: linux裸机安装nginx,linux