求解:如何把一个两位数转换为字符
这个用一个函数就可以了 char?buff[10]; sprintf(buff,"d",25); 结果buff就是025 我上面的就是只转换不输出的函数 追问 : 那好,请帮我看看下面的代码哪里出错了 printf("Input an order。 'I' for 'Insert a student`s message'。
'F' for'Find a student`s Message'
'P' for 'Print Rate'
'E' for 'end'。
"); scanf("%c",&command1); while(command1!='E'){ if(comman...全部
这个用一个函数就可以了 char?buff[10]; sprintf(buff,"d",25); 结果buff就是025 我上面的就是只转换不输出的函数 追问 : 那好,请帮我看看下面的代码哪里出错了 printf("Input an order。
'I' for 'Insert a student`s message'。
'F' for'Find a student`s Message'
'P' for 'Print Rate'
'E' for 'end'。
"); scanf("%c",&command1); while(command1!='E'){ if(command1=='I'){ printf("Input the number
"); scanf("%d",num); sprintf(number,"d",num); //到这里,就显示main。
exe无法运行 printf("Input the name
"); scanf("%s",name); printf("Input the Chinese score
"); scanf("%d",&chinese); printf("Input the Math score
"); scanf("%d",&math); printf("Input the English score
"); scanf("%d",&english); printf("Input the CCSA score
"); scanf("%d",&ccsa) ; printf("Input the phonenumber
"); scanf("%s",phonenumber); InsertMessage(&studentDataBase,num,name,number,chinese,math,english,ccsa,phonenumber); Total(total,&studentDataBase); 程序不完整,要看你的number是怎么定义的 你的 scanf("%d",num);写错了应该是 scanf("%d",&num); 。
收起