题目
有以下程序: #include <stdio.h> struct STU { char name[10]; int num; }; void f1(struct STU c) { struct STU b={"LiSiGuo",2042}; c=b; } void f2(struct STU *c) { struct STU b={"SanDan",2044}; *c=b; } main() { struct STU a={"YangSan",2041}, b={"WangYin",2043}; f1(a); f2(&b); printf("%d%d\n",a.num,b.hum); } 执行后的输出结果是()。
A.2041 2044
B.2041 2043
C.2042 2044
D.2042 2043
第1题
设文件test.txt中原已写入字符串Begin,执行以下程序后,文件中的内容为【 15 】 。
#include <stdio.h>
main()
{ FILE *fp;
fp= fopen("test.txt”, ”w+”);
fputs("test",fp);
fclose(fp);
}
第2题
以下程序中函数setup的功能是返回形参指针s1和s2所指字符串中较小字符串的首地址: # include<stdio. h> # include<string. h> char * scmp(char * s1, char * s2) { if(strcmp(s1, s2)<0) return(s1); else return(s2); } main() { int i; char string[20], str[3][20]; for(i=0; i<3; i++)gets(str[i]); strcpy(string, scmp(str[0], str[1])); strcpy(string, scmp(string, str[2])); printf("% s\n", string); } 若运行时依次输入:abcd、abba和abc3个字符串,则输出结果为______。
A.abcd
B.abba
C.abc
D.abca
第3题
有以下程序:
# include< iostream>
执行这个程序,输出结果是()。
第7题
第8题
有以下程序: #include <iostream> #include <fstream> using namespace std; int main () { ofstream ofile; char ch; ofile.open ("abc.txt"); cin>>ch; while (ch!='#' ) { cin>>ch; ofile.put(ch);
A.程序编译时出错
B.abc#
C.abc
D.#
第9题
A.10
B.20
C.0
D.出错
第11题
有以下程序
#include <stdio.h>
#include <string.h>
main()
{ printf("%d\n",strlen ("ATS\n012\1") ); }
程序运行后的输出结果是
A)3
B)8
C)4
D)9
为了保护您的账号安全,请在“赏学吧”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!