题目内容

写出下列程序的执行结果是:__________________。#include using namespace std;struct Node{ char * s ; Node * q ;} ;void main(){ Node a[ ] = { { "Mary", a+1 }, { "Jack", a+2 }, { "Jim", a } } ; Node *p = a ; cout << p->s <<","; cout << p->q->s <<","; cout << p->q->q->s <<","; cout << p->q->q->q->s << endl ;}

查看答案
更多问题

写出下列程序的执行结果是:__________________。#include using namespace std;struct Employee{ char name[ 20 ] ;char sex ;} ;void fun( Employee *p ){ if( (*p).sex == 'f' ) cout << (*p).name << endl ;}void main(){ Employee emp[5] = { "Liming", 'm', "wang", 'f', "Luwei", 'm' } ; int i ; for( i=0; i<3; i++ ) fun( emp+i ) ;}

写出下列程序的执行结果是:__________________。#include using namespace std;struct Data{ int n ; double score ;} ;void main(){ Data a[3] = { 1001,87,1002,72,1003,90 } , *p = a ; cout << (p++)->n <<","; cout << (p++)->n <<","; cout << p->n++ <<","; cout << (*p).n++ << endl ;}

写出下列程序的执行结果是:__________________。#include #include using namespace std;void main(){ char str[][10] = { "vb", "pascal", "c++" }, s[10] ; strcpy( s , ( strcmp( str[0], str[1] ) < 0 ? str[0] : str[1] ) ) ; if( strcmp( str[2], s ) < 0 ) strcpy( s, str[2] ) ; cout << s << endl ;}

写出下列程序的执行结果是:__________________。#include using namespace std;void main(){ char s1[] = "Fortran" , s2[] = "Foxpro" ; char *p , *q ; p = s1 ; q = s2 ; while( *p && *q ) { if ( *p == *q ) cout << *p ; p ++ ; q ++ ; } cout << endl ;}

答案查题题库