C语言 不知错c语言在哪里编写

C语言统计各种字符类型数目,不知道哪里错了_百度知道
C语言统计各种字符类型数目,不知道哪里错了
else if(c &gt, other=%d&#92:括号内是说明输入2 (repeat=2)Reold building room 123,不要改变与输入输出有关的语句;digit=0.Programming is fun输出letter=17、空格,z'9')
blank++:输入一行字符;.h&gt。例;a'other=0; && c &if((c &gt、数字和其他字符的个数/ && c &)
digit ++;getchar();= '%d&void main( ){int ri, '0'repeat&n&quot,letter=%d;= 'Z&#39, ri& && c &else if(c=='10);printf(&quot, &repeat);A'letter=0, digit=0, other=0*/*统计字符程序填空;stdio,分别统计出其中的英文字母;scanf(&))
letter ++;for(ri=1, other=1letter=16。输入一个正整数repeat (0&lt,= &#39,= &#39, other),做repeat 次下列运算;blank=0, digit=3; ) || ( c &= &#39, blank=3, blank=%d;#include & ri++){c = getchar(),=else
other ++;;= &#39, digit=%d, blank=2
我有更好的答案
按默认排序
&nbsp.A'&
&&&&nbsp,&c&for&&&&c&;&&nbsp.jpg" target="_blank" title="点击查看大图" class="ikqb_img_alink"><img class="ikqb_img" src="&=&;digit&& char&&&&将下面的这句从for&&nbsp://h;&&&&lt.com/zhidao/pic/item/2f738bd4b31ccf0708ffd8;)
&&other=%d\n&&nbsp.jpg" />程序改了;getchar();&&nbsp.jpg" esrc="=&if(c&||&
else&&循环内移出到&/zhidao/wh%3D450%2C600/sign=a4b0dbfc17ce36d3a6b1/2f738bd4b31ccf0708ffd8;other&&&&&#39,&&&#39;main(&printf(&repeat);=&nbsp,&&&z&#39,&&digit=%d;&c&
else&nbsp!;&nbsp.hiphotos.h&letter&&if(c==&#39;++;&)&&&int&nbsp,注意后面的注释#include&nbsp.&&#39;&
if((c&=& other=0,&&&other);&/zhidao/wh%3D600%2C800/sign=da28c63c2a83f9da39f6/2f738bd4b31ccf0708ffd8;循环内移出到&&nbsp,你看看吧;&=&=&&
else&nbsp://h;&++;=&&nbsp,&&#39,&%d& scanf(&&)&(&&&#39; blank=0;&#39;a&#39,&=&ri++){
c&blank=%d!<a href="&c;))
&0&#39;//&nbsp://h;上面&&&&&nbsp,&&&#39;&&amp你好;9&#39,&将下面的四句从for& int&&&&blank++;){ int&for& digit=0;&Z&#39.&
&&nbsp.&&&letter=%d; letter=0;++;&&&nbsp.&gt,&下面&for(ri=1; getchar();c&nbsp,&&ri&lt
你getchar 一次只能获取一个字符 怎么做统计啊 scanf(&%d&, &repeat);getchar();for(ri=1; ri&= ri++){
letter = blank = digit = other = 0;
while((c = getchar())!=&#39;&#92;n&#39;){
if((c &= &#39;a&#39; && c &= &#39;z&#39; ) || ( c &= &#39;A&#39; && c &= &#39;Z&#39;))
letter ++; else if(c &= &#39;0&#39; && c &= &#39;9&#39;)
digit ++;else if(c==&#39; &#39;)
blank++;else
}printf(&letter=%d, blank=%d, digit=%d, other=%d&#92;n&, letter, blank, digit, other);}
2个地方要修改一下。1
blank=0;digit=0;letter=0;other=0;要拿到循环体以外,前面即可2
输出显示的语句调整一下,放在循环体外最后给你加了句system(&pause&);暂停看看,不过有的编译系统不支持。#include &stdio.h&void main( ){int ri,int blank, digit, letter,scanf(&%d&, &repeat);getchar();blank=0;digit=0;letter=0;other=0;for(ri=1; ri&= ri++){c = getchar();if((c &= &#39;a&#39; && c &= &#39;z&#39; ) || ( c &= &#39;A&#39; && c &= &#39;Z&#39;))
letter ++; else if(c &= &#39;0&#39; && c &= &#39;9&#39;)
digit ++;else if(c==&#39; &#39;)
blank++;else
other ++;}printf(&letter=%d, blank=%d, digit=%d, other=%d&#92;n&, letter, blank, digit, other);system(&pause&);}
还是不行,试过了
你全部拷贝覆盖试试看
&#include&&stdio.h&void&main(&){int&ri,&int&blank,&digit,&letter,&char&c;scanf(&%d&,&&repeat);getchar();blank=0;digit=0;letter=0;other=0;for(ri=1;&ri&=&ri++){c&=&getchar();if((c&&=&&#39;a&#39;&&&&c&&=&&#39;z&#39;&)&||&(&c&&=&&#39;A&#39;&&&&c&&=&&#39;Z&#39;))&&&&&&&&&&&&letter&++;&else&if(c&&=&&#39;0&#39;&&&&c&&=&&#39;9&#39;)&&&&&&&&&&&&&&&digit&++;else&if(c==&#39;&&#39;)
&&&blank++;else&&&&&&&&&&&&&other&++;printf(&letter=%d,&blank=%d,&digit=%d,&other=%d\n&,&letter,&blank,&digit,&other);}
肯定有错了,你每次输入一个字符,都把那四个计数器置位0了,,,是不????那个置0的操作在第一次初始化时候做就行了,,然后你最后那个打印,应该放在循环外,,
其他类似问题
c语言的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁C语言求余代码,表示不知道错哪了,求指教。_百度知道
C语言求余代码,表示不知道错哪了,求指教。
printf(&quot:&; return 0;;int main(){ float num1,num2;); scanf(&quot,num1%num2);n&#include&%f%f&n;余数是%f&#92,&num1;%f&#92; printf(&quot,num1%num2),&num2); result=%f&#47.h&请输入两个数,*求余*&#47&#47
提问者采纳
int&main(){int&nbsp,num2;余数是%d\n&%;%d%d&quot,&printf(&余数是%d\n&scanf(&result=num1%num2;&nbsp,&num1;0;printf(&}上面是程序,你试试吧,你对语法的理解不好;printf(&%d%d&quot,&amp,看程序;请输入两个数,对照你的程序对比一下那不一样,result).h&gt,0;main(){int&nbsp,看注释;int&,&scanf(&quot:#include&num1;stdio.h&gt,num1%num2);return&nbsp,result,求余数;num1;请输入两个数:&:#include&,只能是整数;也可以这样写;num2);num2););//求余数就是两个数&;);num1:&return&nbsp,不能是浮点数&nbsp,上面那么例子也是printf(&quot,num2程序改好了
提问者评价
其他类似问题
c语言的相关知识
按默认排序
其他2条回答
类型错了float是实型
不能取余的
应定义为整型int
&#47;*求余*&#47;#include&stdio.h&int main(){ int num1,num2, printf(&请输入两个数:&); scanf(&%d%d&,&num1,&num2); result=%d&#47;n%d&#92;n,num1%num2); printf(&余数是%d&#92;n&,num1%num2); return 0;}还是有三处错误
#include&stdio.h&int main(){ int num1,num2, printf(&请输入两个数:&); scanf(&%d%d&,&num1,&num2); result=num1%num2; printf(&余数是%d&#92;n&,result); return 0;}学C,建议你仔细看看书,多写写程序
基本语法都没理解,能写对么
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁简单的C语言程序不知道哪里错了。_百度知道
简单的C语言程序不知道哪里错了。
3&2&(1&#47;);); else
printf(&quot#include&lt.h&4)&2)) printf(&quot,明显是3才对啊; }不知道为什么会输出2;int main(){
提问者采纳
/2 = 0应该改为 3.0/4 = 01/4
提问者评价
其他类似问题
(1&#47,0表示逻辑假;2&4结果为0;2的结果是0;0因为,3&#47,结果还是0在C语言中,表示条件不成立所以执行else后的语句,表达式(3/);4)&gt,1&#47:if((3/2)的计算是这样的;4)&(1/2)) 后,0&gt:printf(&quot
c语言程序的相关知识
按默认排序
其他1条回答
2 = 0不满足&gt3/关系;4 = 01&#47
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁C语言设int x=2,y=1;则表达式(!x||y--)的值。我算的是0,答案是1.不知道错在哪?_百度知道
C语言设int x=2,y=1;则表达式(!x||y--)的值。我算的是0,答案是1.不知道错在哪?
不知道错在哪,答案是1,y=1。我算的是0!x||y--)的值;则表达式(C语言设int x=2
提问者采纳
x||y--)首先是,后面是1,再对y进行自减,而输出y的值则是0。所以输出1!x就是0,而||只要前面或者是后面的任意一个是真就是真。所以||的前面是0,y--的意思是先用y现在的值进行计算答案是1(
提问者评价
其他类似问题
其他2条回答
y=1,当(!x||y--)执行后才能将y减1,y--!x=0。所以,为1。这句话执行后其实很简单;两者或后
!x这个表达式为0而后面一个表达式为1也,而||表示或,也就是说一个假和一个真取或运算还是为真,所以表达式为真即1
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁一道c语言题不知道哪里错了,求大神指点。_百度知道
一道c语言题不知道哪里错了,求大神指点。
}}void compute(float*pscore[20];i&i++) {
for(j=0;3;
scanf(&j++) {
compute();i&5;&#92;void input(float score[4][5]){ ;
input(score);i&
pscore=&score[0][0];%7,i;score[%d][%d]&I
float*i++)
for(i=0,&score[i][j]);3;
output(score);n& }}void output(float score[4][5]){ n&4;
*(*(pscore+3)+j)=sum&#47;
printf(&j++)
*(*(pscore+i)+4)+=*(*(pscore+i)+j),j;i++) {
for(j=0,score[i][j]);i&
float sum=0,j;.1f&
} } for(i=0;
for(i=0;j++)
printf(&quot,j),score),j;3.h&4;j&3#include&j&j&lt,const score[3][4]){
%f&4;;j++)
printf(&j&); }}main(){
float score[4][5]={0};
for(j=0:&#92;i++)
sum+=*(*(pscore+i)+j)
我有更好的答案
按默认排序
for(i=0;I++)
for(j=0;j++)
for(j=0;i&4;j&lt!比如说
score[4][5]
for(i=0!,遍历范围错了数组遍历;5;i&3;j&4
问题太多了,就拿input函数来说,没有返回值,后面score都为空,
for(i=0;i&4;I++)
for(i=0;i&3;I++)
for(j=0;j&5;j++)
for(j=0;j&4;j++)
其他类似问题
c语言的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁

我要回帖

更多关于 c语言在哪里编写 的文章

 

随机推荐