编程论坛's Archiver

heliuyang 发表于 2007-11-16 18:54

大家看下这个程序为什么不能运行

请大家帮我看哈 谢谢 我用的是VC++遍的 但不能运行 怎么班?<BR># include"stdio.h"<BR>main()<BR>{<BR>    int key;<BR> printf("***多人密码***\n\n");<BR> printf("请输入密码: ");<BR> scanf("%d",&amp;key);<BR> switch(key)<BR> {<BR> case 123:<BR>   printf("欢迎您,何刘洋.\n\n");<BR>   break;<BR> case 456:<BR>   printf("欢迎您,赵建强.\n\n");<BR>   break;<BR> default:<BR>  printf("  没有您的档案  \n 程序终止 \07\n\n");<BR>  break; <BR> }<BR>   <BR>}<BR>

mengfan1987 发表于 2007-11-16 19:14

你把这个试试!我在6.0里运行的<BR># include&lt;iostream.h&gt;<BR># include"stdio.h"<BR>void main()<BR>{<BR>    int key;<BR>    printf("***多人密码***\n\n");<BR>    printf("请输入密码: ");<BR>    scanf("%d",&amp;key);<BR>switch(key)<BR>{<BR>case 123:<BR>   printf("欢迎您,何刘洋.\n\n");<BR>   break;<BR>case 456:<BR>   printf("欢迎您,赵建强.\n\n");<BR>   break;<BR>default:<BR>  printf("  没有您的档案  \n 程序终止 \07\n\n");<BR>  break; <BR>}<BR>   <BR>}

h13077395959 发表于 2007-11-16 19:57

建议不要用scanf和printf语句,取而代之为 cout和cin

sunzh05 发表于 2007-11-16 20:23

# include&lt;iostream.h&gt;<BR>就这原因吧,现在编程习惯性的写上````

allenhu2006 发表于 2007-11-16 20:32

<P>呵呵<BR>1L的朋友给的好象可以了啊<BR>语法全忘了哦百学了</P>

qq598369 发表于 2007-11-17 15:01

scanf printf跟cout cin有撒区别啊?

火乍弓单 发表于 2007-11-17 15:30

# include"stdio.h"<BR>main()<BR>{<BR>    int key;<BR>printf("***多人密码***\n\n");<BR>printf("请输入密码: ");<BR>scanf("%d",&amp;key);<BR>switch(key)<BR>{<BR>case 123:<BR>   printf("欢迎您,何刘洋.\n\n");<BR>   break;<BR>case 456:<BR>   printf("欢迎您,赵建强.\n\n");<BR>   break;<BR>default:<BR>  printf("  没有您的档案  \n 程序终止 \07\n\n");<BR>  <FONT color=#f70909>break;</FONT> <BR>}<BR>   <BR>}<BR>去掉break试试<BR>

火乍弓单 发表于 2007-11-17 15:33

# include&lt;iostream.h&gt;<BR>void main()<BR>{<BR>    int key;<BR>    cout&lt;&lt;"***多人密码***\n\n";<BR>    cout&lt;&lt;"请输入密码: ";<BR>    cin&gt;&gt;key;<BR>    switch(key)<BR>        {<BR>            case 123:<BR>            cout&lt;&lt;"欢迎您,何刘洋.\n\n"; break;<BR>            case 456:<BR>            cout&lt;&lt;"欢迎您,赵建强.\n\n"; break;<BR>            default:<BR>            cout&lt;&lt;"没有您的档案  \n 程序终止 \07\n\n"; <BR>        }<BR>   <BR>}

火乍弓单 发表于 2007-11-17 15:35

#include&lt;iostream.h&gt;<BR>#include&lt;stdio.h&gt;<BR>void main(void)<BR>{<BR>    int key;<BR>    cout&lt;&lt;"***多人密码***\n\n";<BR>    cout&lt;&lt;"请输入密码: ";<BR>    cin&gt;&gt;key;<BR>    switch(key)<BR>        {<BR>            case 123:<BR>            cout&lt;&lt;"欢迎您,何刘洋.\n\n"; break;<BR>            case 456:<BR>            cout&lt;&lt;"欢迎您,赵建强.\n\n"; break;<BR>            default:<BR>            cout&lt;&lt;"没有您的档案  \n 程序终止 \07\n\n"; <BR>        }<BR>   <BR>}

liangjian 发表于 2007-11-17 15:36

谁知道呢?<BR>

zhaocqdx 发表于 2007-11-17 20:58

#include&lt;iostream.h&gt;<BR>#include&lt;stdio.h&gt;<BR>void main(void)<BR>{<BR>    int key;<BR>    cout&lt;&lt;"***多人密码***\n\n";<BR>    cout&lt;&lt;"请输入密码: ";<BR>    cin&gt;&gt;key;<BR>    switch(key)<BR>        {<BR>            case 123:<BR>            cout&lt;&lt;"欢迎您,何刘洋.\n\n"; break;<BR>            case 456:<BR>            cout&lt;&lt;"欢迎您,赵建强.\n\n"; break;<BR>            default:<BR>            cout&lt;&lt;"没有您的档案  \n 程序终止 \07\n\n"; <BR>        }<BR>   <BR>}

页: [1]

Powered by Discuz! Archiver 6.1.0  © 2001-2007 Comsenz Inc.