标题:[求助]关于程序测试(编译器)
取消只看楼主
叮叮当
Rank: 1
等 级:新手上路
帖 子:24
专家分:0
注 册:2007-1-2
 问题点数:0 回复次数:2 
[求助]关于程序测试(编译器)
大家新年好,请教一个问题

比如我想测试下面这个程序:大家只看题目就好了,代码细节不重要~

/* 统计各个数字、空白符及其他字符出现的次数 */
#include <stdio.h>
main()
{
int c,i,nwhite,nother;
int ndigit[10];

nwhite = nother = 0;
for ( i = 0; i < 10; ++i )
ndigit[i] = 0;

while ( (c == getchar()) !=EOF )
if ( c >= '0' && c <= '9' )
++ndigit[c-'0'];
else if ( c == ' ' || c == '\n' || c == '\t' )
++nwhite;
else
++nother;

printf("digits=");
for ( i=0; i<10; ++i )
printf("%d",ndigit[i]);
printf(",white space=%d,other=%d\n",nwhite,nother);
}

一般测试其他程序,只要输入好内容按回车就能看到结果了,可是现在这道代码在输入的时候键入回车并不能结束程序,所以我就不知道该怎么查看运行结果了。请问该怎么办呢?
搜索更多相关主题的帖子: 新年 编译 int 
2007-01-02 17:17
叮叮当
Rank: 1
等 级:新手上路
帖 子:24
专家分:0
注 册:2007-1-2
得分:0 
谢谢~
2007-01-02 17:38
叮叮当
Rank: 1
等 级:新手上路
帖 子:24
专家分:0
注 册:2007-1-2
得分:0 
多谢诸位大哥的回答,还有5楼这位大哥的提醒

非常感谢!
2007-01-02 19:39



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-113758-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.748486 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved