c语言,找错
发布网友
发布时间:2022-06-02 17:53
我来回答
共4个回答
热心网友
时间:2023-11-26 20:03
#include<stdio.h>
void main()
{int lan,zi,hong,,san,piao,la,,yan,qiang,O,O,T,TH,F,FI,cO,cT,cTH,cF,cFI,S,cS;/*为什么声明两个O,而且在hong的变量名后面还加两个逗号*/
scanf("%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d",&lan,&zi,&hong,,&san,&piao,&la,&,&yan,&qiang,&O,&T,&TH,&F,&FI,&S);/*这里hong的后面又是两个逗号*/
cO=9-lan-zi*2-hong*2-san-yan-qiang-O;
cT=8-lan*2-zi-hong-san-piao-qiang-T;
cTH=9-lan*3-hong*2-san-piao-la-TH;
cF=8-lan*2-zi-hong-piao-la--F;
cFI=9-lan-zi*2-hong*2-la--yan-FI;
cS=8-zi*3-hong--yan-qiang-S;
printf("菜=%d\n游戏=%d\ne=%d\n音乐=%d\n办公=%d\n画=%d\n"),cO,cT,cTH,cF,cFI,cS;}
还有楼主要注意一点,如果scanf("%d,%d",&a,&b),在引号里面加了逗号,那么在输入的时候也应该输入逗号比如
1,2
热心网友
时间:2023-11-26 20:03
#include"stdafx.h"
#include<stdio.h>
void main()
{int lan,zi,hong,san,piao,la,,yan,qiang,o,T,TH,F,FI,cO,cT,cTH,cF,cFI,S,cS;
scanf("%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d",&lan,&zi,&hong,&san,&piao,&la,&,&yan,&qiang,&o,&T,&TH,&F,&FI,&S);
cO=9-lan-zi*2-hong*2-san-yan-qiang-o;
cT=8-lan*2-zi-hong-san-piao-qiang-T;
cTH=9-lan*3-hong*2-san-piao-la-TH;
cF=8-lan*2-zi-hong-piao-la--F;
cFI=9-lan-zi*2-hong*2-la--yan-FI;
cS=8-zi*3-hong--yan-qiang-S;
printf("菜=%d\n游戏=%d\ne=%d\n音乐=%d\n办公=%d\n画=%d\n",cO,cT,cTH,cF,cFI,cS);
}
热心网友
时间:2023-11-26 20:04
#include<stdio.h>
void main()
{int lan,zi,hong,san,piao,la,,yan,qiang,O,T,TH,F,FI,cO,cT,cTH,cF,cFI,S,cS;
scanf("%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d",&lan,&zi,&hong,&san,&piao,&la,&,&yan,&qiang,&O,&T,&TH,&F,&FI,&S);
cO=9-lan-zi*2-hong*2-san-yan-qiang-O;
cT=8-lan*2-zi-hong-san-piao-qiang-T;
cTH=9-lan*3-hong*2-san-piao-la-TH;
cF=8-lan*2-zi-hong-piao-la--F;
cFI=9-lan-zi*2-hong*2-la--yan-FI;
cS=8-zi*3-hong--yan-qiang-S;
printf("菜=%d\n游戏=%d\ne=%d\n音乐=%d\n办公=%d\n画=%d\n",cO,cT,cTH,cF,cFI,cS);}
热心网友
时间:2023-11-26 20:04
&hong,,&san
hong,,san
多了逗号