写出下列程序的执行结果是:__________________。#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 ;}
写出下列程序的执行结果是:__________________。#include using namespace std;void main(){ char *str[] = { "c++", "basic", "pascal" } ; char **p ; int i ; p = str ; for( i=0 ; i<3 ; i++ ) { cout << *( p+i ) ; if(i!=2) cout<<","; }}
写出下列程序的执行结果是:__________________。#include using namespace std;int f( int [][3], int, int ) ;void main(){ int a[][3] = { 0, 1, 2, 3, 4, 5, 6, 7, 8 } ; cout << f( a, 3, 3 ) << endl ;}int f( int a[][3], int row, int col ){ int i, j, t=1 ; for( i=0; i|
写出下列程序的执行结果是:__________________。#include using namespace std;int f(int [],int);void main(){ int a[] = { -1, 3, 5, -7, 9, -11 } ; cout << f( a, 6 ) << endl ;}int f( int a[], int size ){ int i, t=1 ; for( i=0 ; i0 ) t *= a[i] ; return t;}