|
![]() | 作者: luckdate [luckdate]
![]() |
登录 |
简单的C程: #include "stdio.h" main() {int a; char b; printf("please input the number:");/*①*/ scanf("%d",&a); printf("please input the char:");/*②*/ scanf("%c",&b); printf("%d %c",a,b); } 问题在这里: 运行时屏幕显示 please input the number: 安提示输入数字并回车后程序关闭~ 再进入程序看~发现在是这麽显示的 please input the number:8 please input the char: 8 (光标) 想了好久终于明白了原因~(菜嘛) 想问问大虾们有没有好的解决方法~需要的输出结果为: 8 * 但请不要把①和②交换顺序~就是仍要屏幕显示为: please input the number:8 please input the char:* 8 * 请各位帮忙~谢谢啊我的E-MAIL是luck_531@hotmail.com |
地主 发表时间: 11/03 23:25 |
![]() | 回复: ricky [ricky] ![]() |
登录 |
把%c改成%s |
B1层 发表时间: 11/04 10:32 |
![]() | 回复: wsgwindows [wsgwindows] ![]() |
登录 |
printf("please input the number:");/*①*/ scanf("%d",&a); printf("please input the char:");/*②*/ scanf("%c",&b); 在这里加上一条 printf("/n"); 就OK了。 我也是一个新手。 |
B2层 发表时间: 11/04 16:18 |
![]() | 回复: wsgwindows [wsgwindows] ![]() |
登录 |
printf("please input the number:");/*①*/ scanf("%d",&a); printf("/n"); printf("please input the char:");/*②*/ scanf("%c",&b); 在这里加上一条 就OK了。 我也是一个新手。 |
B3层 发表时间: 11/04 16:32 |
![]() | 回复: syshunter [syshunter] ![]() |
登录 |
嘿嘿,看来和尚弄高级的东西时间长了,基本的给忘了,不怕不怕。 |
B4层 发表时间: 11/04 21:18 |
|
20CN网络安全小组版权所有
Copyright © 2000-2010 20CN Security Group. All Rights Reserved.
论坛程序编写:NetDemon
粤ICP备05087286号