微信搜索关注"91考试网"公众号,领30元,获取公务员、事业编、教师等考试资料40G!
填空:
#include <stdio.h>
void fun(char *s, char *p)
{ int i, j, n, x, t;
n=0;
for(i=0; s[i]!='\0'; i++) n++;
for(i=1; i<n-2; i=i+2) {
/**********found**********/
___1___;
/**********found**********/
for(j=___2___+2 ; j<n; j=j+2)
if(s[t]>s[j]) t=j;
if(t!=i)
{ x=s[i]; s[i]=s[t]; s[t]=x; }
}
for(i=1,j=0; i<n; i=i+2, j++) p[j]=s[i];
/**********found**********/
p[j]=___3___;
}
main()
{ char s[80]="baawrskjghzlicda", p[50];
printf("\nThe original string is : %s\n",s);
fun(s,p);
printf("\nThe result is : %s\n",p);
}
改错:
#include <math.h>
#include <stdio.h>
float fun ( float num )
{ int s ;
float n, t, pi ;
t = 1 ; pi = 0 ; n = 1 ; s = 1 ;
/**************found**************/
while(t >= num)
{
pi = pi + t ;
n = n + 2 ;
s = -s ;
/**************found**************/
t = s % n ;
}
pi = pi * 4 ;
return pi ;
}
main( )
{ float n1, n2 ;
printf("Enter a float number: ") ;
scanf("%f", &n1) ;
n2 = fun(n1) ;
printf("%6.4f\n", n2) ;
}
编程:
#include <stdio.h>
#include <string.h>
#define LEN 20
void fun (char a[], char b[], int n)
{
}
main( )
{ char str1[LEN], str2[LEN] ;
int n ;
void NONO ( );
printf("Enter the string:\n") ;
gets(str1) ;
printf("Enter the position of the string deleted:") ;
scanf("%d", &n) ;
fun(str1, str2, n) ;
printf("The new string is: %s\n", str2) ;
NONO() ;
}
第五套:
填空:
1、t=i 2、i 3、0
改错:
1、while(t >= num) 改为while((fabs(t))>=num)
2、t = s % n ;改为t=s/n;
编程:
void fun (char a[], char b[], int n)
{
int i=0,j=0;
while(a[i])
{
if(i!=n)
{
b[j]=a[i];
j++;
}
i++;
}
b[j]='\0';
}