C语言模拟题 下载本文

#include #include #define N 9 main()

{ int arr[N],i;

printf(\ for(i=0; i

scanf(\ &arr[i] printf(\

/**/ for(i=N-1; i<0; i--) /**/ for(i=N-1; i>=0; i--) printf(\ \ printf(\ getch(); } 18、

#include void main() {

int m,n,k; float ans; clrscr();

printf(\ scanf(\ ans= m / /**/(float) n(/**/ ; k=/**/ (int) /**/ (ans*1000);

printf(\ The 3th decimal place is: %d\\n\ getch(); }?? 19、

#include void main() {

float x,y,z,min;

float f_min(float,float,float);

printf(\ scanf(\ min=f_min(x,y,/**/z /**/);

printf(\ getch(); }

float f_min(float a,float b,float c) {

float t,k;

k=/**/(b

20、??

#include #include main() {

char s1[100], s2[100]; int i,s_len;

printf(\ gets(s1);

s_len = strlen(s1);

for(i=0; i

{

if( s1[i] >= '0' && s1[i] <= '8') s2[i] = s1[i] + 1;

else if( /**/ s1[i] = '9' /**/ ) s1[i] == '9' s2[i] = '0'; else

s2[i] = s1[i]; }

/**/ s2[i] = '/0'; /**/ s2[i] = '\\0'; puts(s2); getch(); } 21、

#include #include void main() {

char src[40],tag[40];

char tab[4][2]={{'b','f'},{'c','e'},{'e','b'},{'f','c'}}; int i,j=0;

printf(\ gets(src);

strcpy(tag,src); while(tag[j]) {

for(i=0;i<=3;i++) {

/**/ if(tag[j]=tab[i][0]) /**/ if(tag[j]==tab[i][0]) {

/**/ tag[j]=tab[1][i]; /**/ tag[j]=tab[i][1]; break; } } j++; }

printf(\

printf(\ getch(); } 22、

#include

int find(int num[],/**/int n/**/, int x) {

int left,right,mid; right = n-1; left = 0 ;

while(left <= right)

{ mid= ( left + right)/2 ;

if(/**/x x < num[mid] /**/) right = mid-1;

else if( x > num[mid]) left = mid+1; else

return mid; }

return -1; }

void main()

{ int num[]={2,5,7,10,22,29,31,55}; int p,n;

n = sizeof(num)/sizeof(int); p = find(num,n,7); printf(\ getch(); } 23、