举一反三
- 下列程序的输出结果为_________。 #include struct abc { char c; float v; }; void main() { abc a={'B',98.5}; cout
- void main( ) { char a[5] = {'a', 'b', 'c'}; int x = strlen(a); a[2] = '\0'; int y = sizeof(a); int z = strlen(a); cout<<x<<" "<<y<<" "<<z;}
- 若输入ab,程序运行结果为()。 main() { char a[5]; scanf("%s",a); printf("%c,%c",a[1],a[2]); }
- 以下程序的输出结果是( )。 #include<iostream.h> void func(char**m) { ++m: cout<<*m<<endl; } void main() { static char*a[]={"MORNING","AFTERTOON","EVENING"}; char**n; n=a: func(n); } A: 为空 B: MORNING C: AFTERTOON D: EVENING
- 以下程序的输出结果是 。 #include<iostream.h> void func(char**m) { ++m: cout<<*m<<end1; } void main() { static char*a[]={"MORNING","AFTERTOON","EVENING"}; char**n: n=a; func(n); } A: 为空 B: MORNING C: AFTERTOON D: EVENING
内容
- 0
以下程序段的运行结果是( )。 char x[5]={'a', 'b', '\0', 'c', '\0'}; cout<<x; A: 'a''b' B: ab C: ab c D: abc
- 1
运行程序,程序输出结果是( )#include using namespace std;int main(){ struct stud{ char num [5]; int s[4]; double ave;} a;cout A: 31 B: 32 C: 29 D: 30
- 2
阅读下面程序: #include<iostream.h> void fun1(char a,char b) { char c; c=a;a=b;b=c; } void fun2(char &a,char &b) { char c; c=a;a=b;b=c; } void main() { char a,b; a=’x’;b=’y’; fun1(a,b);cout<<a<<b; a=’x’;b=’y’; fun2(a,b);cout<<a<<b; } 则该程序的输出为______。
- 3
以下程序执行结果是()。 #include #include void main() { char s1[10],*s2="ab\0cdef"; strcpy(s1,s2); printf("%s",s1); } A: ab\0cdef B: abcdef C: a D: 以上答案都不对
- 4
有以下程序段,输出结果为()。#include<stdio.h>struct student{int num;char name[20];float score;};main(){struct student stu[5];printf("%d",sizeof(stu));} A: 140 B: 160 C: 5 D: 随机值