单选题 C语言 题号 #2273993 以下函数不能用于向文件中写入数据的是( )。 A.hell B.fwrite C.fputc D.fprintf 收起答案及解析 进入在线模考 参考答案 A 答案解析 ftell是返回文件当前指针。 你可能感兴趣的试题 1 请补充main()函数,该函数的功能是:把一个字符串中的所有小写字母字符全部转换成大写字母字符,其他字符不变,结果保存原来的字符串中。 例如,当str[M]="abcdefl23ABCD",结果输出:"ABCDEFl23ABCD"。 注意:部分源程序给出如下。 请勿改动main()函数和其他函数中的任何内容,仅在横线上填人所编写的若干表达式或语句。 试题程序: #include<stdio.h> #include<stdlib.h> #include<conio.h> #define M 80 void main() { int j; char str[M]="abcdefl23ABCD"; char*pf=str; system("CLS"); printf("***original string***\n"); puts(str); 【1】 while(*(pf+j)) { if(*(pf+j)>='a'&&*(pf+j)<='Z') { *(pf+j)= 【2】 ; 【3】 ; } else j++; } printf("****new string****\n"); puts(str); system("pause");} 查看解析 → 2 下列给定程序中,函数proc()的功能是:根据输入的3个边长(整型值),判断能否构成三角形:若能构成等边三角形,则返回3;若是等腰三角形,则返回2;若能构成三角形则返回 1;若不能,则返回0。 例如,输入3个边长为3,4,5,实际输入时,数与数之间以Enter键分隔而不是逗号。请修改程序中的错误,使它能得出正确的结果。 注意:不要改动main()函数,不得增行或删行,也不得更改程序的结构。 试题程序: #include<stdio.h> #include<math.h> int proc(int a,int b,int c) { if(a+b>c&&b+c>a&&a+c>b) { if(a= =b&&b= =c) //****found**** return 1; else if(a= =b||b= =c||a= =c) return 2; //****found**** else return 3; } else return 0; } void main() { int a,b,C,shape; printf("\nlnput a,b,C:"); scanf("%d%d%d",&a,&b,&c); printf("\na=%d,b=%d,c=%d\n",a,b,c); shape=proc(a,b,c); printf("\n\nThe shape:%d\n",shape); } 查看解析 → 3 请编写函数proc(),其功能是:将str所指字符串中下标为偶数的字符删除,串中剩余字符形成的新串放在t所指数组中。 例如,当str所指字符串中的内容为abcdefg,则在t所指数组中的内容应是bdf。 注意:部分源程序给出如下。 请勿改动main()函数和其他函数中的任何内容,仅在函数proc()的花括号中填入所编写的若干语句。 试题程序: #include<stdlib.h> #include<conio.h> #include<stdio.h> #include<string.h> void proc(char*str,char t[]) { } void main() { char str[100],t[100]; system("CLS"); printf("\nPlease enter string str:"); scanf("%S",str); proc(str,t); printf("\nThe result is:%s\n",t); } 查看解析 →