intmain(){printf("+++++++++++++++++++++++++
");printf("++
");printf("++
");printf("+++++++++++++++++++++++++
");printf("+++++++++++++++++++++++++
");return0;}
是这样吗?
C语言荷兰国旗希望能解答下
intmain(){printf("+++++++++++++++++++++++++
");printf("++
");printf("++
");printf("+++++++++++++++++++++++++
");printf("+++++++++++++++++++++++++
");return0;}
是这样吗?
#include<stdio.h>#include<stdlib.h>intmain(){inta;inti,temp;printf("请输入3种颜色(0为红,1为白,2为蓝)放入数组:
");for(i=0;i<3;i++)scanf("%d",&a[i]);if(a[0]==0&&a==1&&a==2)printf("荷兰旗颜色序列!
");elseif(a[0]==0&&a==2&&a==1){temp=a;a=a;a=temp;printf("白旗和蓝旗交换
");}elseif(a[0]==1&&a==0&&a==2){temp=a[0];a[0]=a;a=temp;printf("红旗和白旗交换
");}elseif(a[0]==1&&a==2&&a==0){temp=a;a=a;a=temp;temp=a;a=a[0];a[0]=temp;printf("白旗和红旗交换,蓝旗与白旗交换
");}elseif(a[0]==2&&a==0&&a==1){temp=a[0];a[0]=a;a=temp;temp=a;a=a;a=temp;printf("蓝旗和红旗交换,白旗和红旗交换
");}else{temp=a;a=a[0];a[0]=temp;printf("白色和蓝色交换
");}system("pause");}