更多"请补充函数fun( ),该函数的功能是:依次取出字符串中所有的小写字母"的相关试题:
[填空题]请补充函数fun( ),该函数的功能是:依次取出字符串中所有的小写字母以形成新的字符串,并取代原字符串。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun( )的横线上填入所编写的若干表达式或语句。
试题程序:
#include<stdio.h>
#include<conio.h>
void fun(char *s)
{
int i=0;
char *p=s;
while( 【1】 )
{
if (*p>=’a’&&*p<=’z’)
{
s[i]=*p;
【2】 ;
}
p++;
}
s[i]= 【3】 ;
}
main( )
{
char str[80];
clrscr( );
printf("/nEnter a string:");
gets(str);
printf("/n/nThe string is:/%s/n",str);
fun(str);
printf("/n/nThe string of changing
is:/%s/n",str);
}
[填空题]给定程序MODI1.C函数fun的功能是:依次取出字符串中所有数字字符,形成新的字符串,并取代原字符串。
请改正程序中的错误,使它能得出正确的结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。
文件MODI1.C内容如下:
#include<stdio.h>
void fun(char *s)
int i,j;
for(i=0,j=0; s[i]!=’/0’;i++)
if(s[i]>=’0’&& s[i]<=’9’)
/**********found**********/
s[j]=s[i];
/**********found**********/
S[j]="/0";
void main( )
char item[80];
printf("/nEnter a string:");
gets(item);
printf("/n/nThe string is:/"%s/"/n",item);
fun(item);
printf("/n/nThe string of changing is: /"%s/"/n",item);
[填空题]下列给定程序中,函数fun( )的功能是:依次取出字符串中所有的数字字符,形成新的字符串,并取代原字符串。
请改正函数fun( )中的错误,使它能得出正确的结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。
试题程序:
#include <stdio.h>
#include <conio.h>
void fun(char *s)
{int i,j;
for(i=0,j=0; s[i]!= ’/0’; i++)
if(s[i]>= ’0’&&s[i]<= ’9’)
/*************found**************/
s[j]=s[i];
/*************found**************/
s[j]="/0";
}
main( )
{char item[80];
clrscr( );
printf("/nEnter a string: ");gets(item);
printf("/n/nThe string is:/%s/n", item);
fun(item);
printf("/n/nThe string of changing is :
/%s/n",item);
}
[填空题]下列给定程序中,函数fun( )的功能是:依次取出字符串中所有的字母,形成新的字符串,并取代原字符串。
请改正程序中的错误,使它能得到正确结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。
试题程序:
#include<stdio.h>
#include<conio.h>
void fun(char*S)
int i,j;
for(i=0,j=0;s[i]! =’/0’;i++)
/*************found************/
if((s[i]>=’A’&&s[i]<=’Z’)&&(s[i]>= ’a’&&S[i]<=’z’,))
s[j++]=s[i];
/*************found*************/
s[j]="/0";
main( )
char item[80];
clrscr( );
printf("/nEnter a string:");
gets(item);
printf("/n/nThe string is:/%s/n",item);
fun (item);
printf("/n/nThe string of changing
is:/%S/n",item);
[填空题]请补充函数fun( ),该函数的功能是将字符串tt中的大写字母都改为对应的小写字母,其他字符不变。例如,若输入“Are you come from Sichuan”,则输入“are you come from sichuan”。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun( )的横线上填入所编写的若干表达式或语句。
试题程序:
#include<stdio.h>
#include<string.h>
#include<conio.h>
char *fun(char tt[])
int i;
for(i=0;tt[i];i++)
if((tt[i]>=’A’)&&( 【1】 ))
【2】 ;
return ( 【3】 ) ;
main( )
char tt[81];
printf("/nPlease enter a string:");
gets(tt);
printf("/nThe result string is: /n%s",
fun(tt));
[填空题]下列给定程序中,函数proc( )的功能是:依次取出字符串中所有的字母字符,形成新的字符串,并取代原字符串。
例如,若输入的字符串是:ab232bd34bkw,则输出结果是:abbdbkw。
请修改程序中的错误,使它能得到正确结果。
注意:不要改动main( )函数,不得增行或删行,也不得更改程序的结构。
试题程序:
#include<stdlib.h>
#include<stdio.h>
#include<conio.h>
void proc(char * str)
int i, j;
for(i=0, j=0; str[i]!=’/0’; i++)
//************found*************
if((str[i]>=’A’ &&str[i]<=’z’)&&(str[i]>=’a’&&str[i]<=’z’))
str[j++]=str[i];
//************found*************
str[j]="/0";
void main( )
char item[80];
system("CLS");
printf("/nEnter a string: ");
gets(item);
printf("/n/nThe string is:%s/n", item);
proc(item);
printf("/n/nThe string of changing is: %sin", item);
[填空题]下列给定程序中,函数proc( )的功能是:依次取出字符串中所有的数字字符,形成新的字符串,并取代原字符串。例如原始字符串是“ab45c6djfd789”,则输出后的字符是“456789”。
请修改函数proc( )中的错误,使它能得出正确的结果。
注意:不要改动main( )函数,不得增行或删行,也不得更改程序的结构。
试题程序:
#include<stdlib.h>
#include<stdio.h>
#include<conio.h>
void proc(char*s)
int i,j;
for(i=0,j=0;s[i]!=’/0’;i++)
if(s[i]>=’0’&&s[i]<=’9’)
//************found*************
s[j]=s[i];
//************found**************
s[j]="/0";
void main( )
char str[80];
system("CLS");
printf("/nEnter a string:");gets(str);
printf("/n/nThe string is:%s/n",str);
proc(str);
printf("/n/nThe string of changing is:%s/n",str);
[填空题]请补充main函数,该函数的功能是:把一个字符串中的所有小写字母字符全部转换成大写字母字符,其他字符不变,结果保存原来的字符串中。
例如:当str[N]“123 abcdef ABCDEF!”,结果输出:
“123ABCDEFABCDEF!”。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun的横线上填入所编写的若干表达式或语句。
试题程序:
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#define N 80
void main( )
int j;
char str[N]="123abcdef ABCDEF!";
char *pf=str;
clrscr( );
printf("*** original string ***/n");
puts(str);
【1】 ;
while(*(pf+j)).
if(*(pf+j)>=’a’&&* (pf+j)<=’z’)
*(pf+j)= 【2】 ;
j++;
else
【3】 ;
printf("****** new string ******/n");
puts(str);
system("pause");
[简答题]填空题
请补充main函数,该函数的功能是:把一个字符串中的所有小写字母字符全部转换成大写字母字符,其他字符不变,结果保存原来的字符串中。
例如:当str[N]=“123 abcdef ABCDEF!”,结果输出:“123 ABCDEF ABCDEF!”。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun的横线上填入所编写的若干表达式或语句。
试题程序:
#include
#include
#include
#define N 80
void main( )
{
int j;
char str[N]=" 123abcdef ABCDEF!";
char *pf=str;
clrscr( );
printf("***original string ***/n");
puts(str);
【1】;
while(*(pf+j))
{
if(*(pf+j)>=’’a’’&&*(pf+j)<=’’z’’)
{
*(pf+j)=【2】;
j++;
}
else
【3】;
}
printf("******new string******/n");
puts(str);
system("pause");
}
[填空题]请补充函数proc( ),该函数的功能是将字符串str中的大写字母都改为对应的小写字母,其他字符不变。例如,若输入“How Are You”,则输出“how are you”。
注意:部分源程序已给出。
请勿改动主函数main和其他函数中的任何内容。
试题程序:
#include<stdio.h>
#include<string.h>
#include<conio.h>
char *proc(char str[])
int i;
for(i=0; str[i]; i++)
if((str[i]>=’A’)&&( (1) )
(2) ;
return( (3) );
void main( )
char str[81];
printf("/nPlease enter a string: ");
gets(str);
printf("/nThe result string is: /n%s",
proc(str));
[简答题]给定程序MODI1.C中函数fun的功能是: 依次取出字符串中所有数字字符, 形成新的字符串, 并取代原字符串。
请改正函数fun中指定部位的错误, 使它能得出正确的结果。
注意: 不要改动main函数, 不得增行或删行, 也不得更改程序的结构!
给定源程序:
#include
void fun(char *s)
{ int i,j;
for(i=0,j=0; s[i]!=’/0’; i++)
if(s[i]>=’0’ && s[i]<=’9’)
s[j]=s[i];
s[j]="/0";
}
main( )
{ char item[80];
printf("/nEnter a string : ");gets(item);
printf("/n/nThe string is : /"%s/"/n",item);
fun(item);
printf("/n/nThe string of changing is : /"%s/"/n",item );
}
[填空题]数组str全由大小写字母字符组成。请补充函数fun( ),该函数的功能是:把str中的字母转换成紧接着的下一个字母,如果原来的字母为‘z’或‘Z’,则相应地转换成‘a’或‘A’,结果仍保存在原数组中。
例如,输入“StudentZz”,则输出“TuvefouAa”。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun( )的横线上填入所编写的若干表达式或语句。
试题程序:
#include<stdio.h>
#define N 80
void fun(char s[])
int i;
for(i=0; 【1】 ;i++)
if(s[i]==’z’||s[i]=’Z’)
s[i]-= 【2】 ;
else
s[i]+= 【3】 ;
main( )
char str[N];
clrscr( );
printf("/n Input a string:/n");
gets(str);
printf("/n*** original string***/n");
puts(str);
fun(str);
printf("/n*** new string***/n");
puts(str);
[填空题]从键盘输入一组小写字母,保存在字符数组str中。请补充函数fun( ),该函数的功能是:把字符数组str中字符下标为奇数的小写字母转换成对应的大写字母,结果仍保存在原数组中。
例如,输入“acegikm”,输出“aCeGiKm”。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun( )的横线上填入所编写的若干表达式或语句。
试题程序:
#include <stdio.h>
#define N 80
void fun (char s[])
int i=0;
while ( 【1】 )
if (i%2!=0)
s[i]-= 【2】 ;
【3】 ;
main ( )
char str [N];
clrscr ( );
printf("/n Input a string:/n");
gets (str);
printf("/n*** original string ***/n");
puts (str);
fun (str);
printf ("In*** new string ***/n");
puts (str);
[填空题]从键盘输入一组小写字母,并保存在字符数组str中。请补充函数fun( ),该函数的功能是:把字符数组str中ASCII码为奇数的小写字母转换成对应的大写字母,结果仍保存在原数组中。
例如,输入“abcdefg”,输出“AbCdEfG”。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun( )的横线上填入所编写的若干表达式或语句。
试题程序:
#include<stdio.h>
#define N 80
void fun(char s[])
{
int i;
for( 【1】 ; 【2】 ;i++)
{
if( 【3】 )
s[i]-=32;
}
}
main( )
{
char str[N];
clrscr( );
printf("/n lnput a string:/n");
gets(str);
printf("/n*** original string ***/n");
puts (str);
fun (str);
printf("/n*** new string ***/n");
puts (str);
}