更多"下列给定程序中,函数fun( )的作用是:将字符串tt中的小写字母都改"的相关试题:
[填空题]下列给定程序中,函数fun( )的作用是:将字符串tt中的小写字母都改为对应的大写字母,其他字符不变。例如,若输入“edS,dAd”,则输出“EDS,DAD”。
请改正程序中的错误,使它能得到正确结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。
试题程序:
#include <stdio.h>
#include <string.h>
#include <conio.h>
/*************found*************/
char fun(char tt[ ])
int i;
for(i=0;tt[i];i++)
/*************found*************/
if((tt[i]>=’A’)&&(tt[i]<=’Z’))
tt[i]-=32;
return(tt);
main( )
int i;
char tt[81];
clrscr( );
printf("/nPlease enter a string:");
gets(tt);
printf("/nThe result string is:/n%s",fun(tt));
[填空题]下列给定程序中,函数fun( )的作用是,将字符串tt中的大写字母都改为对应的小写字母,其他字符不变。例如,若输入"Ab,cD",则输出"ab, cd"。
请改正函数fun( )中的错误,使它能得出正确的结果。
注童:不要改动main函数,不得增行或删行,也不得更改程序的结构。
试题程序:
#include <stdio.h>
#include <string.h>
#include <conio.h>
char *fun (char tt[])
int i;
for(i=0; tt[i]; i++)
/**************found**************/
if((’A’ <=tt[i]||(tt[i]<=’z’ ))
tt[i]+=32;
return(tt);
main( )
int i;
char tt[81];
clrscr( );
printf("/nPlease enter a string:");
gets(tt);
printf("/nThe result string is:/n %s",
fun(tt));
[简答题]下列给定程序中,函数fun的功能是:将tt所指字符串中的小写字母全部改为对应的大写字母,其他字符不变。
例如,若输入“Ab,CD”,则输出“AB,CD”。
请改正程序中的错误,使它能得出正确的结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构!
试题程序:
#lnclude<conio.h>
#include<stdio.h>
#include<string.h>
char*fun(char tt[])
(
int i;
for(i=O;tt[1];i++)
/******found******/
if((tt[i]>=’a’)||(tt[i]<=’z’))
/******found********/
tt[i]+=32;
return(tt);
main( )
char tt[81];
printf("/nPlease enter a string:");
gets(tt);
printf(/nThe result string is/n%s"fun(tt));
[填空题]下列给定程序中,函数fun( )的功能是:从字符串s中,删除所有大写字母’F’。
请改正程序中的错误,使它能得到正确结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。
试题程序:
#include <stdio.h>
void fun(char *s)
{
int i, j;
/*************found**************/
for(i=j=0; s[i]!= ’0’;i++)
if(s[i] != ’F’)
/*************found**************/
s[j]=s[i];
s[j]=’/0’;
}
main ( )
{
char s[80];
printf("/nEnter a string: ");
gets(s);
printf("The original string: ");
puts(s);
fun(s);
printf("The string after deleted: ");
puts(s);
printf("/n/n ");
}
[填空题]下列给定程序中,函数fun( )的功能是:从字符串s中,删除所有大写字母’F’。
请改正程序中的错误,使它能得到正确结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。
试题程序:
#include <stdio.h>
void fun(char *s)
int i, j;
/*************found**************/
for(i=j=0; s[i]!= ’0’;i++)
if(s[i] != ’F’)
/*************found**************/
s[j]=s[i];
s[j]=’/0’;
main ( )
char s[80];
printf("/nEnter a string: ");
gets(s);
printf("The original string: ");
puts(s);
fun(s);
printf("The string after deleted: ");
puts(s);
printf("/n/n ");
[简答题]【说明】
给定函数fun的功能是:将从键盘上输入的每个单词的第一个字母转换为大写字母,输入时各单词必须用空格隔开,用“.”结束输入。
【函数】
int fun(char *c,int status)
if( (1) ==’’)
return 1;
else
if( (2) && (3) && (4) )
(5) =’A’-’a’;
return 0;
main( )
int flag=1;
char ch;
printf("请输入一字符串,用点号结束输入!/n");
do
ch=getchar( );
flag=fun(&ch,flag);
putchar(ch);
while(ch!=’.’);
printf("/n");
[简答题]【说明】
给定函数fun的功能是:将从键盘上输入的每个单词的第一个字母转换为大写字母,输入时各单词必须用空格隔开,用“.”结束输入。
【函数】
int fun(char *c,int status)
{
if( (1) ==’’)
return 1;
else
{
if( (2) && (3) && (4) )
(5) =’A’-’a’;
return 0;
}
}
main( )
{
int flag=1;
char ch;
printf("请输入一字符串,用点号结束输入!/n");
do {
ch=getchar( );
flag=fun(&ch,flag);
putchar(ch);
}while(ch!=’.’);
printf("/n");
}
[填空题]下列给定程序是建立一个带头结点的单向链表,并用随机函数为各结点数据域赋值。函数fun( )的作用是求出单向链表结点(不包括头结点)数据域中的最大值,并且作为函数值返回。
请改正程序中的错误,使它能得出正确的结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。
试题程序:
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
typedef struct aa
{ int data;
struct aa *next;
} NODE;
/*************found**************/
fun (NODE *h)
{ int max=-1;
NODE *p;
p=h->next;
while(p)
{ if(p->data>max)
max=p->data;
/*************found**************/
p=h->next;
}
return max;
}
outresult(int s, FILE *pf)
{ fprintf(pf, "/nThe max in link :%d/n
",s);}
NODE *creatlink(int n, int m)
{ NODE *h,*p,*s,*q;
int i, x;
h=p=(NODE *)malloc(sizeof(NODE));
h->data=9999;
for(i=1;i<=n;i++)
{ s=(NODE *) malloc(sizeof(NODE));
s->data=rand( )%m; s->next=p->next;
p->next=s; p=p->next;
}
p->next=NULL;
return h;
}
outlink(NODE *h,FILE *pf)
{ NODE *p;
[简答题]请编写一个函数fun( ),该函数的功能是:返回给定字符串中大写字母字符的个数。
如字符串"Hello World"中,大写字母的个数为2个。
注意:部分源程序已存在文件PROC5.CPP中。
请勿修改主函数和其他函数中的任何内容,仅在函数fun( )的花括号中填写若干语句。
文件PROC5.cpp的内容如下:
//PROC5.cpp
#include<iostream>
#include<string>
using namespace std;
int fun(char *str);
int main( )
char str[ ]="Chinese Computer World";
cout<<fun(str)<<end;
return 0;
int fun(char *str)
//**********