正在加载图片...
第一部分c语言程序设计上机指导 47 if( a[i] >=b[i])c[i]=a[i 1 else c[ i ]=b[i j uts 分析结果 6.当运行以下程序时,从键盘输入: teacher<CR>和 student<CR>,写出运行结果。 #include <stdio. h> #include string.h> max i inta【2][ for( i=0 i i for (i=0 i i i++) or (3=0 j if I max=a [i][j];m=i in=jiI printf(”影dd旨dn 分析结果 运行结果 、完成程序 要求:根据要求,分析给出的上下语句,填写程序。 1.以下程序的功能是输出两个字符串中对应相等的字符,请在 上填写正确 内容 #include <string.h> main( i char x []="programming char y while(x[ i ]1 0’&ky[i] [主第一部分 C 语言程序设计上机指导 ·47· ·47· if ( a [ i ] >= b [ i ] ) c [ i ] = a [ i ] - 32 ; else c [ i ] = b [ i ] - 32 ; + + i ; } c [ i ] = ‘ \ 0 ‘ ; puts ( c ) ; } 分析结果 运行结果 6.当运行以下程序时,从键盘输入:teacher<CR>和 student<CR>,写出运行结果。 #include <stdio.h> #include < string.h> main() { int i , j , m , n , i , max ; int a[ 2 ][ 80 ] ; for ( i=0 ; i < =1 ; i + +) gets( a[ i ]) ; t = a [ 0 ][ 0 ] ; for ( i=0 ; i < =1 ; i + +) { l = strlen ( ); for ( j = 0 ; j < =1 ; j + + ) if ( a [ i ][ j ] > t ) { max = a [ i ][ j ] ; m = i ; n = j ;} } printf ( “ %d % d %d \n” , max , m , n ); } 分析结果 运行结果 二、完成程序 要求:根据要求,分析给出的上下语句,填写程序。 1.以下程序的功能是输出两个字符串中对应相等的字符,请在_______上填写正确 内容。 #include <stdio.h> #include <string.h> main( ) { char x [ ]= “programming” ; char y [ ] = “Fortran” ; int i=0 ; while( x[ i ] ! = ‘ \0 ’ && y [ i ] ! = ‘ \0 ’) if ( x [ i ] == y [ i ] ) printf ( “ %c ”, ___________ ) ; else ___________ ; }
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有