本文介绍了K& R直方图帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




盖伊'我知道有几篇关于此的帖子,但我不想要

来阅读它们,因为毫无疑问是答案发布了!


这是我的尝试,但我有点卡住了。我不是在寻找

的答案我正在寻找正确方向的一点......


#include< stdio.h>


int main(无效)

{

int c,nl,w;

c = nl = w = 0;

int noOfWords [10];

// ctrl c无法正常工作$ used

while((c = getchar())!=''$''){

++ nl;

if(c ==''''| | c ==''\t''|| c ==''\ n''){

//每个单词都没有字符...

noOfWords [w] = nl;

++ w;

//重置字母数

nl = 0;

}

}


int i,j;


for(i = 0 ; i< w; ++ i){


for(j = 0; j< noOfWords [i]; ++ j){

if(// tbc){//我被困在这里我是我的


//试图说出我在哪里?是不是
printf(" *"); //时间打印星号或

空格?????

}其他{

printf("");

}


}

printf(" \ n");

}


返回0;

}


我是否朝着正确的方向前进?????? br />

任何帮助都将不胜感激....


谢谢


Michael

Hi,

Guy''s I know there are several posts about this, however I do not want
to read them as answers are undoubtedly posted!

Here is my attempt but I''m slightly stuck. I''m not looking for the
answer I''m looking for a point in the right direction.....

#include <stdio.h>

int main(void)
{
int c, nl, w;
c = nl = w = 0;
int noOfWords[10];
//ctrl c doesn''t work properly $ used
while((c = getchar()) != ''$'') {
++nl;
if (c == '' '' || c == ''\t'' || c == ''\n'') {
//hold no of characters for each word...
noOfWords[w] = nl;
++w;
//reset the letter count
nl = 0;
}
}

int i, j;

for (i = 0; i < w; ++i){

for (j = 0; j < noOfWords[i]; ++j) {
if( //tbc ){ //I''m stuck here I''m I''m

//trying to say where am I? is it
printf("*"); //time to print a asterisk or a
space?????
}else {
printf(" ");
}

}
printf("\n");
}

return 0;
}

Am I even going in the right direction??????

Any help would be greatly appreciated....

Thanks

Michael

推荐答案





给我们一个战斗机会:哪个K& R练习?

对于那些没有K& R的人来说:简短的轮廓。


更重要的是:你有什么期望?会发生什么?

Give us a fighting chance: Which K&R exercise?
For those who do not have their K&R handy: Short outline.

More important: What did you expect? What does happen?


这篇关于K&amp; R直方图帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-11 00:34