为什么不执行scanf

64288 2003-07-03 08:32:14
main( )
{char y='y';
long a;
int c;
char b[20];
for(;y=='y';)
{
printf("\n please input stnumber name score");
scanf("%l,%s,%d",&a,b,&c);跳过了,为什么不执行
printf("\n have other student's information ");
scanf("%c",&y);

}
}
...全文
80 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
zxm954712 2003-07-03
  • 打赏
  • 举报
回复
I think the program is OK .
what's the matter with these codes
:-)
point_to 2003-07-03
  • 打赏
  • 举报
回复
void main( )
{
char y='y';
long a;
int c;
char b[20] ;

for(;y=='y';)
{
printf("\n please input stnumber name score");
scanf("%d%s%d",&a, b,&c);//跳过了,为什么不执行
printf("\n have other student's information :\n");
fflush(stdin);
scanf("%c",&y);

}
return;
}
zxm954712 2003-07-03
  • 打赏
  • 举报
回复
I think the program is OK .
what's the matter with these codes
:-)
64288 2003-07-03
  • 打赏
  • 举报
回复
请试这个程序
main( )
{char y='y';
do
{ long a;
char b[20];
int c;
printf("\n please input stnumber name score");
scanf("%ld,%s,%d",&a,b,&c);

printf("\n have other student's information "); /*从第二个学生开始的信息*/
scanf("%c",&y);

}while(y=='y');
}
E17 2003-07-03
  • 打赏
  • 举报
回复
#include "stdafx.h"
#include "stdio.h"

int main(int argc, char* argv[])
{
char y='y';
long a;
int c;
char b[20];
for(;y=='y';)
{
printf("\n please input stnumber name score");
scanf("%l,%s,%d",&a,b,&c);//跳过了,为什么不执行
printf("\n have other student's information ");
scanf("%c",&y);

}
}
我试了一下 可以输入的啊。。。
tnds 2003-07-03
  • 打赏
  • 举报
回复
scanf前加一句fflush(stdin)试试!

69,380

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧