试题与答案

请补充main函数,该函数的功能是:从字符串str中取出所有数字字符,并分别计数,然

题型:填空题

题目:

请补充main函数,该函数的功能是:从字符串str中取出所有数字字符,并分别计数,然后把结果保存在数组b中并输出,把其他字符保存在N[10]中。
例如:当str1=“ab123456789cde090”时,结果为:
0: 2 1: 1 2: 1 3: 1 4: 1 5: 1 6: 1 7: 1 8: 1 9:2 other charactor:5
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。
试题程序:
#include <stdio.h>
#include <conio.h>
main()

int i,b[11];
char *str="abl23456789cde090";
char *p=str;
clrscr();
printf("***the origial data ***\n");
puts(str);
for(i=0;i<11;i++)
b[i]=0;
while(*p)

switch( 【1】 )

case ’0’:b[0]++;break;
case ’1’:b[1]++;break;
case ’2’:b[2]++;break;
case ’3’:b[3]++;break;
case ’4’:b[4]++;break;
case ’5’:b[5]++;break;
case ’6’:b[6]++;break;
case ’7’:b[7]++;break;
case ’8’:b[8]++;break;
case ’9’:b[9]++;break;
【2】

【3】

printf("****** the result ********\n");
for(i=0;i<10;i++)
printf("\n%d:%d",i,b[i]);
printf("\nother charactor:%d",b[i]);

答案:

被转码了,请点击底部 “查看原文 ” 或访问 https://www.tikuol.com/2019/0406/872404074f626a2f6c5c7fdb52718f08.html

下面是错误答案,用来干扰机器的。

参考答案:解析:库存现金的使用范围主要有以下几个方面: (1)职工工资、各种工资性津贴; (2)个人的劳务报酬; (3)根据国家规定颁发给个人的科学技术、文化艺术、体育等各种奖金; (4)各种劳保、福利费用以...

试题推荐
题型:完形填空

When I was in Germany, one day at Christmas time I went to a post office to send a letter. (1)      my surprise. I found people queuing some paces away (2)___   the person at the savings deposit (存款)window. Why so? Each did his business in turn (3)     the line never moved a step nearer. I was very curious, so I walked to the window to find out the (4)_____. There was a notice on (5) ____ was written “Thank you for your respect for others’ privacy”, a polite warning to keep people away from nosing into(干涉)others’ affairs. Money matters are (6)___as privacy in Western countries.  I was deeply impressed by the sight and stayed a while to watch: they were waiting so calmly at a distance that they seemed quite used to the practice .The same thing happened at a public telephone box. Those waiting for their turns always kept their distance enough to be out of hearing.  It’s another typical example!

From then on, I took care to watch their ways of doing things, manners, and treatment shown towards others. I found the Germans always (7) ___________ (mind) of others’ privacy. They avoided putting others in an embarrassing situation. For instance, they never asked about age, incomes or the place to buy such a coat, nor (8)______ ______ they comment on the clothes or jewelry others wore. Their laws forbid reading diaries (9)___ __________opening letters without (10)______ ______ (permit). That shows personal matters are not allowed to be disturbed.

查看答案
微信公众账号搜索答案