下列程序的输出结果是______。
include<iostream.h>
void main( )
{
char a[]="abcdabcabfgacd";
int i1=0,i2=0,i=0;
while(a[i])
{
if(a[i]=="a")i1++;
if(a[i]=="b")i2++;
i++;
}
cout<<i1<<""<<i2<<endl;
}
第1题:
以下程序的输出结果是【 】。
include <stdio.h>
include <string.h>
char *fun(char *t)
{ char *p=t;
return (p+strlen(t)/2);
}
main()
{ char *str="abcdefgh";
str=ftm(str);
puts(str);
}
第2题:
下列程序的输出结果是( )。 #include<iostream.h> void main() { char*Str; str="testI"; cout<<str[5]; }
A.test!
B.test
C.空字符
D.异常
第3题:
下列程序的输出结果是______。
include <iostream.h>
include <cstring.h>
using namespace std;
void fun(const char*s,char &C) {c=s[strlen (s)/2];}
int main {)
{
char str [] ="ABCDE";
char ch=str[1];
fun(str,sh);
cout<<Ch;
return 0;
}
第4题:
以下程序的输出结果是【 】。
include <stdio.h>
include <string.h>
char *fun(char *0
{ char *p--t;
return (p+strlen(t)/2);
}
main()
{ char *str="abcdefgh";
str=ftm(str);
puts(str);
}
第5题:
下列程序的运行结果是______。
include<iostream.h>
class Base
{
public:
void f(int x){cout<<“Base:”<<x<<endl;}
);
class Derived:public Base
{
public:
void f(char*str){cout<<“Derived:”<<str<<endl;}
};
void main(void)
{
Base*pd=ne
第6题:
以下程序的输出结果是( )。 #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
第7题:
以下程序的输出结果是【 】。
include<iostream. h>
void main() {
char *p= "12345678" , *r;
long *q;
q=(long *)p;
q++;
r= (char *) q:
cout<<r;
}
第8题:
下列程序的执行结果是【 】。
include <iostream. h>
int a;
int sum_a(void)
{
a=a+5;
return a;
}
void main(void)
{
a = a+sum_a();
cout<<a<<endl;
}
第9题:
以下程序运行后的输出结果是【 】。
include<iostream.h>
void main()
{
char a[]="abcdabcabfgacd";
int i 1=0,i2=0,i=0;
while (a[i])
{
if (a[i]=='a')
il++;
if (a[i]=='b')
i2++;
i++;
}
cout<<il<<' '<<i2<<endl;
}