网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

要调用字符串函数时,在#include命令行中应包含()

  • A、”stdio.h”
  • B、”string.h”
  • C、”math.h”
  • D、”ctype.h”

参考答案

更多 “要调用字符串函数时,在#include命令行中应包含()A、”stdio.h”B、”string.h”C、”math.h”D、”ctype.h”” 相关考题
考题 调用系统函数时,要先使用include命令包含该系统函数的原型语句所在的系统头文件。() 此题为判断题(对,错)。

考题 请编写函数fun(),对长度为7个字符的字符串,除首、尾字符外,将其余5个字符按ASCII码值降序排列。例如:原来的字符串为CEAedca,则排序后输出为CedcEAa。注意:部分源程序已存在文件test22_2.cpp中。请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。文件test22_2.cpp的内容如下:include <iostream.h>include <stdio.h>include <ctype.h>include <conio.h>void int fun(char *s, int num){}void main ( ){char s[10];printf ("输入7个字符的字符串:");gets(s);fun(s,7);cout<<s;}

考题 请编写函数fun(),对长度为7个字符的字符串,除首、尾字符外,将其余5个字符按ASCII码值升序排列。例如:原来的字符串为BdsihAd,则排序后输出为 BAdhisd。注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。试题程序:include <stdio.h>include <ctype.h>include <conio.h>int fun(char*s,int num){}main(){char s[10];clrscr();printf("输入7个字符的字符串:");gets(s);fun(s,7);printf("\n%s",s);}

考题 编写一个函数,该函数可以统计一个长度为2的字符串在另一个字符串中出现的次数。例如,假定输入的字符串为asd asasdfg asd as zx67 asd mklo,子字符串为as,则应当输出6。注意:部分源程序给出如下。请勿改动主函数main和具他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。试题程序:include <conio.h>include <stdio.h>include <string.h>int fun(char *str, char *substr){}main ( ){char str[81],substr[3];int n;clrscr ();printf ("输入主字符串 ");gets (str);printf ("输入子字符串");gets (substr);puts (str);puts (substr);n=fun (shr, substr);printf("n=%d\n ",n);}

考题 阅读下列程序,当运行函数时,输入asd af aa z67,则输出为include include i 阅读下列程序,当运行函数时,输入asd af aa z67,则输出为 #include <stdio.h> #include <ctype.h> #include <string.h> int fun(char*str) { int i,j=0; for(i=0;str[i]!='\0';i++) if(str[i]!='')str[j++]=str[i]; str[j]='\0'; } main() { char str[81];A.asdafaaz67B.asdafaa267C.asdD.z67

考题 请编写函数fun(),其功能是:将s所指字符串中下标为奇数的字符删除,串中剩余字符形成的新串放在t所指数组中。例如,当s所指字符串中的内容为siegAHdied,则在t所指数组中的内容应是seAde。注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。试题程序:include<conio.h>include<stdio.h>include<string.h>void fun(char*S,char t[]){}main(){char s[100],t[100];clrscr();printf("\nPlease enter string s:");scanf("%S",S);fun(S,t);printf("\nThe result is:%s\n",t);}

考题 下列给定程序中函数fun()的功能是:求出字符串中最后一次出现的子字符串的地址,通过函数值返回,在主函数中输出从此地址开始的字符串;若未找到,则函数值为NULL。例如,当字符串中的内容为abcdabfabcdx,t中的内容为ab时,输出结果应是abcdx。当字符串中的内容为abcdabfabcdx,t中的内容为abd时,则程序输出未找到的信息:Not found!请改正程序中的错误,使它能得出正确的结果。注意;不要改动main函数,不得增行或删行,也不得更改程序的结构。试题程序:include<stdio.h>include <conio.h>include <string.h>char *fun(char *s,char *t){char *p,*r,*a;/*************found**************/a=Null;while(*s){ p=s;r=t;while(*r)/*************found**************/if(r= =p) {r++;p++;}else break;if(*r=='\0') a=s;s++;}return a;}main(){char s[100],t[100],,*p;clrscr();printf("\nPlease enter string S: ");scanf("%s",s);printf("\nPlease enter substring t: ");scanf("%s",t);p=fun(S,t);if(p) printf("\nThe result is:%s\n",p);else printf("\nNot found!\n ");}

考题 函数ReadDat()的功能是实现从文件IN2.DAT中读取一篇英文文章存入到字符串数组xx中:请编制函数 StrOL(),该函数的功能是:以行为单位对行中以空格或标点符号为分隔的所有单词进行倒排。最后把已处理的字符串(应不含标点符号)仍按行重新存入字符串数组xx中,最后调用函数WriteDat()把结果xx输出到文件OUT2.DAT中。例如:原文:YOU He MeI am a student.结果: Me He Youstudent a am I原始数据文件存放的格式是:每行的宽度均小于80个字符,含标点符号和空格。请勿改动主函数main()、读函数ReadDat()和写函数WriteDat()的内容。include <stdio.h>include <string.h>include <conio.h>include <ctype.h>char xx[50] [80];int maxline = 0;/* 文章的总行数 */int ReadDat (void);void WriteDat (void);void StrOL(void){main ( ){clrscr ( );if (ReadDat ()){printf("数据文件 IN2.DAT不能打开! \n\007");return;}StrOL ( );WriteDat ();}int ReadDat (void){FILE *fp;int i = 0;char *p;if((fp = fopen("IN2.DAT", "r")) == NULL) return 1;while(fgets(xx[i], 80, fp) != NULL){p = strchr(xx [i], '\n');if(p) *p = 0;i++;}maxline = i;fclose (rD):return 0;}void WriteDat (void){FILE*fp;int i;clrscr ();fp = fopen("OUT2.DAT", "w");for(i = 0; i < maxline; i++){printf("%s\n", xx[i]);fprintf(fp, "%s\n", xx[i]);}fclose (fp);}

考题 下列程序的功能是:把s字符串中的所有字母改成该字母的下一个字母,字母2改成字母a。要求大写字母仍为大写字母,小写字母仍为小写字母,其他字符不做改变。请编写函数chg(char*s)实现程序要求,最后调用函数readwriteDAT(),读取in36.dat中的字符串,并把结果输出到文件out36.dat中。例如:s字符串中原有的内容为Mn 123Zxy,则调用该函数后,结果为No 123Ayz。注意;部分源程序已给出。请勿改动主函数脚main()和输入输出函数readwriteDAT()的内容。试题程序:include<stdio.h>include<string.h>include<conio.h>include<ctype.h>define N 81void readwriteDAT();void chg(char *s){}main(){char a[N];clrscr();printf("Enter a string:");gets(a);printf("The original string is :");puts(a);chg(a);printf("The string after modified :");puts(a);readwriteDAT();}void readwriteDAT(){int i;char a[N];FILE *rf,*wf;rf=fopen("in36.dat","r");wf=fopen("out36.dat","w");for(i=0;i<10;i++){fgets(a,81,rf);chg(a);fprintf(wf,"%s",a);}fclose(rf);fclose(wf);}

考题 下列给定程序中,函数fun()的功能是:删除字符串s中所有空白字符(包括Tab字符、回车符及换行符)。输入字符串时用’’结束输入。请改正程序中的错误,使它能得出正确的结果。注意:不要改动main函数,不得增行或删行,也不得更改程序的结构.试题程序:include <string.h>include <stdio.h>include <ctype.h>fun(char *p){ int !i, t; char c[80];for(i=0,t=0;p[i];i++)if(!isspace(*(p+i))) c[t++]=p[i];/**********************************/c[t]='\0';strcpy(p,c);}main(){char c,s[80];int i=0;printf("Input a string: ");c=getchar();while(c!='')( s[i]=c;i++;c=getchar();}s[i]="\0";fun(s);puts(s);}

考题 编写函数fun(),它的功能是求n以内(不包括n)同时能被3与7整除的所有自然数之和的平方根s,并做为函数值返回。例如:n为1000时,函数值应为s=153.909064。注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。试题程序:include <conio.h>include <math.h>include <stdio.h>double fun(int n){}main(){clrscr();printf("s=%f\n", fun(1000));}

考题 阅读下列程序,当运行函数时,输入asd af aa z67,则输出为includeincludeinc 阅读下列程序,当运行函数时,输入asd af aa z67,则输出为 #include<stdio.h> #include<ctype.h> #include<string.h> int fun(char*str) { int i,j=0; for(i=0;str[i]!='\0';i++) if(str[i]!='')str[j++]=str[i]; str[j]='\0'; } main() { char str[81]; int n; clrscr(); printf("Input a string:"); gets(str); puts(str); fun(str); printf("%s\n",str); }A.asdafaaz67B.asdafaaz67C.asdD.z67

考题 请编写函数fun(),它的功能是计算:s=(1-In(1)-In(2)-In(3)-…-1n(m))2s作为函数值返回。在C语言中可调用log(n)函数求In(n)。log函数的引用说明是double log(double x)。例如,若m的值为15,则fun()函数值为723.570801。注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。试题程序:include <conio.h>include <stdio.h>include <math.h>double fun(int m){}main(){clrscr();printf("%f\n",fun(15));}

考题 请编写一个函数fun(),它的功能是将一个数字字符串转换为一个整数(不得调用C语言提供的将字符串转为整数的函数)。例如,若输入字符串“-1234”,则函数把它转换为整数值 -1234。注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。试题程序:include <stdio.h>include <string.h>long fun(char *p){}main ( ){char s[6];long n;printf("Enter a string:\n");gets(s);n=fun(s);printf("%ld\n",n);}

考题 阅读下列程序,当运行函数时,输入asd af aa z67,则输出为includeincludeine 阅读下列程序,当运行函数时,输入asd af aa z67,则输出为 #include <stdio.h> #include <ctype.h> #inelude <string.h> int fun(char *str) { int i,j=0; for(i=0;str[i]!='\0';i++) if(str[i]!='')str[j++]=str[i]; str[j]='\0'; } main() { char str[81]; int n; printf("Input a string:"); gets(str); puts(str); fun(str); printf("%s\n",str); }A.asdafaaz67B.asd af aa z67C.asdD.z67

考题 请补充函数fun(char *s),该函数的功能是把字符串中的内容逆置。例如:字符串中原有的字符串为abcde,则调用该函数后,串中的内容变为edcba。注意;部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。试题程序:$include<string.h>include<conio.h>include<stdio.h>define N 81void fun(char*s){int i=0,t,n=strlen(s);for(;【 】;i++){t=*(s+i);【 】;【 】;}}main(){char a[N];clrscr();printf("Enter a string:");gets(a);printf("The original string is:");puts(a);fun(a);printf("\n");printf("The string after modified:");puts(a);}

考题 strlen()库函数与stdio.h头文件问题? strlen()是一个计算字符串长度的这么一个库函数,这个库函数是定义在string.h这个头文件里的,要想使用这个库函数就必须调用预处理命令将string.h添加到当前的代码中,可是为什么在调用string.h这个头文件的基础上还要调用stdio.h这个头文件呢?stdio.h只是一个输入输出函数的这么一个头文件,跟strlen()库函数有什么关系,,,求解。

考题 在下列# include命令中,正确的一条是 ( )A.# include [string.h]B.# include {math.h}C.# include(stdio.h)D.# include<stdio.h>

考题 调用系统函数时,要先使用#include命令包含该系统函数的原型语句所在的系统头文件。()A对B错

考题 下列#include命令中,正确的是()A、#inclue[string.h]B、#include{string.h}C、#include(string.h)D、#include

考题 要调用输入输出函数时,在#include命令行中应包含()A、”stdio.h”B、”string.h”C、”math.h”D、”ctype.h”

考题 使用scanf函数时,在源程序开头()。A、书写#include"stdio.h"B、书写#includeC、不必写#includeD、书写#include"scanf.h"

考题 如果在用户的程序中要使用C库函数中的数学函数时,应在该源文件中使用的include命令是()A、#include〈string.h〉B、#include〈math.h〉C、#include〈stdio.h〉D、#include〈ctype.h〉

考题 一个项目中包含3个函数:main、fa和fb函数,它们之间不正确的调用是()A、在main函数中调用fb函数B、在fa函数中调用fb函数C、在fa函数中调用fa函数D、在fb函数中调用main函数

考题 要调用数学函数时,在#include命令行中应包含()A、”stdio.h”B、”string.h”C、”math.h”D、”ctype.h”

考题 要调用字符函数时,在#include命令行中应包含()A、”stdio.h”B、”string.h”C、”math.h”D、”ctype.h”

考题 判断题调用系统函数时,要先使用#include命令包含该系统函数的原型语句所在的系统头文件。()A 对B 错