|
本题添加时间:2023/4/3 12:59:00 |
|
圆梦客服:王老师 19139051760(微信同号) 19139051760(微信同号) |
[应用题,25分] #include # include void fun(char *w,int m) {char s,*p1,*p2; p1=w; p2=w+m-1; while(p1<> { s=*p1;*p1=*p2;*p2=s; p1++; p2--; } } main() { char a[10]="abcdefghi"; char *p=new char[10]; strcpy(p,"student"); cout<<"compare:"<<> if(strcmp(a,p)==0) cout<<"a == p"<<> if(strcmp(a,p)>0) cout<<"a > p"<<> if(strcmp(a,p)<0) cout<<"a < p"<<> cout<<"before:\n"; cout<<><> cout<<><> cout<<"call fun"<<> fun(a,strlen(a)); fun(p,strlen(p)); cout<<"after:\n"; cout<<><> cout<<><>
} 程序运行结果为:
|
答案是:campare: a
出自
许昌学院面向对象程序设计 青书学堂系统
许昌学院
|
更多试题>>>>
1、[应用题,25分] #include
#include
#include
main()
{
int a=4,b=5,c,d;
cout<<”sqrt(a)=”<< sqrt(a)<
c=a>b?a:b;
cout<<”c=”
2、[应用题,25分] #include
fun(int *s,int n1,int n2)
{ int t;
while(n1<>
{t=*(s+n1);
*(s+n1)=*(s+n2);
*(s+n2)=t;
n1++;n2-
3、[应用题,25分] #include
void f(int *p1, int *p2)
{ int *t;
t=p1;p1=p2;p2=t;
}
main()
{ int a=10,b=20;
cout<<><>
f(&a,
4、[应用题,25分] #include
class Cdate
{
int day,month,year;
public:
Cdate ()
{
day=1;
month=1;
year=1999;
cout<<"defa
5、[应用题,25分]
请在横线中填入程序,完成如下PID控制仿真程序. (注意符号、标点符号、括号用半角)
#include
class AAA
{
int A,B;
public:
AAA()
{A=100;B=200;
|
|