cin>>number;
st[i].get_number(number);
cin>>st[i].score;
}
for(i=0,p=0;i<3;i++)
if(st[p].score<=st[i].score)
_______________;
cout<<"最高成绩为"<st[p].put_number();
cout<<"同学的:
"<}
三、阅读程序写出运行结果
1.
#include
classA
{public:
A(inth,intw):
he(h),we(w){}
~A(){cout<private:
inthe,we;
};
classB:
publicA
{public:
B(inth,intw,inth1,intw1,intl):
A(h,w),obj1(h1,w1){len=l;}
~B(){cout<private:
Aobj1;
intlen;
};
voidmain()
{
Bobj(1,2,3,4,5);
}
2.#include"iostream.h"
#include"stdio.h"
voidfind(charstr1[],charstr2[])
{
inti,j;
for(i=0,j=0;str1[i]!
='\0';i++)
if(str1[i]>='a'&&str1[i]<='z'||str1[i]>='A'&&str1[i]<='Z')
{
str2[j]=str1[i];
j++;
}
str2[j]=’\0’;
}
voidmain()
{
char*a,*b;
a=newchar[];
b=newchar[];
gets(a);
find(a,b);
puts(b);
}
输入字串如下:
aAtg234Hj\n
3.
main()
{
inti,j;
for(i=1;i<=5;i++)
for(j=1;j<=i;j++)
{
printf("%d*%d=%d",i,j,i*j);
if(i==j)printf("\n");
}
}
4.
#include
main()
{ intc;
while((c=getchar())!
='\n')
{ switch(c-'2')
{ case0:
case1