C填空_c填空

2020-02-27 其他范文 下载本文

C填空由刀豆文库小编整理,希望给你工作、学习、生活带来方便,猜你可能喜欢“c填空”。

1、补充程序Ccon011.c,使其计算f(x)x2x21。

2、补充程序Ccon012.c,该程序用公式4(11111)计算圆周率的近似值。357100013、补充程序Ccon013.c,程序实现从10个数中找出最大值和最小值。

Ccon012.c Ccon013.c Ccon011.c

#include #include #include

#include

void main()#include

int max,min;

{ double pi=0;void main()void find_max_min(int *p,int n)

{

long i, sign=1;{

int *q;

for(i=1;i

int x;

max=min=*p;

{

/**/ float f;

/**/

for(q=p;q

p+n

/**/;q++)

pi+=1.0*sign/i;

printf(“Input an integer: ”);

if(/**/

max

/**/)max=*q;

else if(min>*q)min=*q;

sign=/**/-sign /**/;

scanf(“%d”,&x);

}

}

f = /**/(fabs(x)-2)/(x*x+1)/**/;void main()

pi*=/**/ 4

/**/;

printf(“F(x)=%fn”,f);{

int i,num[10];

printf(“%fn”,pi);}

printf(“Input 10 numbers: ”);

}

for(i=0;i

find_max_min(/**/ num

/**/,10);

printf(“max=%d,num=%dn”,max,min);}

1、补充程序Ccon021.c,使其计算满足下式的一位整数A和B的值。

A B

× B A

------------------0 32、补充程序Ccon022.c,使其实现输入若干整数,统计其中大于零和小于零的个数。以零结束输入。

3、补充程序Ccon023.c,该程序可测试歌德巴赫猜想:从键盘上输入一个大于6的偶数,总能找到两个素数,使得这两个素数之和正好等于该偶数。

Ccon021.c Ccon023.c

#include

#include void main()#include {

int a,b,k;int prime(int n)

int plu = /**/ 403

/**/;{ int k,flag=1;

for(a=1;a

for(k=2;k

for(b=1;b

if(n%k==0)

{

{ flag=/**/ 0 /**/;

k =(a*10+b)* /**/(b*10+a)

/**/;

if(k==plu)printf(“A = %d, B = %dn”,a,b);break;}

}

return flag;}

} Ccon022.c void main()#include

{ int num, a;void main()

clrscr();{

int n,a,b;

do

/**/

{ printf(“Please input an even number:”);

a=b=0;

scanf(“%d”, &num);

/**/

}while(num

scanf(“%d”,&n);

for(a=2;a

while(/**/

n!=0

/**/)

{

if(prime(a)&& prime(/**/ num-a /**/))

if(n>0)a++;

printf(“n %d = %d + %d ”, num, a, num-a);

else /**/

b++;

/**/ }

scanf(“%d”,&n);

}

printf(“Positive integer: %d, negative integer: %dn”,a,b);}

1、补充程序Ccon031.c,使其用牛顿迭代法求方程2x4x3x60在1.5附近的根。

2、补充程序Ccon032.c,该程序的功能是将输入的一行字符中的大写字母转变为相应的小写字母,小写字母则转变为相应的大写字母,其余字符不变。

3、补充程序Ccon033.c,其中main函数通过调用average函数计算数组元素的平均值。

Ccon032.c Ccon033.c Ccon031.c

#include #include #include

float average(int *pa,int n)void main()#include { { char s[80];/**/

main()

/**/

int k;

int i;

/**/

float avg=0;

/**/ { float x,x0,f,f1;

printf(“Please input a string: ”);

for(k=0;k

for(i=0;((s[i]=getchar())!='n')&&(i

x=1.5;

avg = avg+/**/ *(pa+k)/**/;

s[i]='';

do

avg = avg/n;

for(i=0;s[i]!='';/**/ i++

/**/)

return avg;

{ x0=x;

{ }

f=((2*x0-4)*x0+3)*x0-6;

if(s[i]>='a'&&s[i]

f1=(6*x0-8)*x0+3;

s[i]=s[i]-32;{ int a[5]={20,30,45,64,23};

else if(/**/s[i]>='A'&&s[i]

float m;

x=x0-f/f1;

m=average(/**/ a /**/, 5);

}/**/ while /**/(fabs(x-x0)>=1e-6);

s[i]=s[i]+32;

printf(“Average=%fn”,m);

printf(“%c”,s[i]);

printf(“the root is: %.2fn”,x);}

} } }

1、补充程序Ccon041.c,使其实现从键盘输入一个同学的姓名(如“Jack”),输出问候该同学的信息(如“Hello, Jack!”)。

2、补充程序Ccon042.c,使程序中的sort()函数用冒泡法对数组a中的m个元素从大到小排序。

3、补充程序Ccon043.c,使程序中的fun()函数能用勾股定理判断一个三角形是否为直角三角形。即输入一个三角形的三边长a,b,c,若能构成直角三角形则返回1,否则返回0。

Ccon043.c Ccon042.c Ccon041.c #include #include

#include #include /**/ #include /**/

int fun(/**/ float a,float b,float c /**/)void sort(int a[], int m)main()

{ { int i, j, t,swap;{ /**/ char /**/ str[11];

for(i=0;i

float temp;

int bTrue = 0;

printf(“Please input a name:n”);

{

if(a

swap = 0;

scanf(“%s”,str);

{ temp = a;

for(j=0;j

printf(“Hello,%s!n”, str);

a = b;

{

getch();

b = temp;

if /**/(a[j]

}

{ }

if(a

swap = 1;

{ temp = a;

t = a[j];

a = c;

a[j] = /**/

a[j+1] /**/;

c = temp;

a[j+1] = t;

}

}

if(fabs(/**/ a*a /**/-(b*b + c*c))

}

bTrue = 1;

if(!swap)break;

return

bTrue;

}

} }

void main()

main(){

{

int a[] = {23,55,8,32,18,2,9};

float a,b,c;

int i,k = sizeof(a)/sizeof(int);

printf(“Please input three numbers:n”);

sort(a,k);

scanf(“%f%f%f”,&a,&b,&c);

for(i=0;i

if(fun(a,b,c)== 1)

printf(“%d ”,a[i]);

printf(“Yesn”);

printf(“n”);

else

getch();

printf(“Non”);}

getch();}

321、补充程序Ccon051.c,使其实现从键盘输入一个整数,输出该数的平方。

2、补充程序Ccon052.c,使程序中的sort()函数用选择法对数组a中的m个元素从小到大排序。

3、补充程序Ccon053.c,使程序中的fun()函数,能根据三角形的三边长a,b,c,用公式s(sa)(sb)(sc),sCcon051.c Ccon052.c #include

#include main()#include { int x;

void sort(int a[], int m)

printf(“Please input a number:n”);

{ int i, j, k, t;

scanf(“%d”, /**/ &x /**/);

for(i = 0;i

printf(“%d*%d=%dn”, x,x, /**/ x*x /**/);

getch();

{ k = i;

for(j=i+1;j

} Ccon053.c

if(a[j]

if(k!= i)#include

{ t = a[k];/**/ float /**/ fun(float a,float b,float c)

a[k]= a[i];{ float s,area;

s = /**/(a+b+c)/2 /**/;

a[i] = /**/ t /**/;

}

s = s*(s-a)*(s-b)*(s-c);

if(s

}

area =-1;}

else

area = sqrt(s);void main()

return area;

{ }

int a[] = {72,25,58,32,2,15,7,64};

int i,m = sizeof(a)/sizeof(int);main()

sort(a,m);{

float a,b,c,area;

printf(“Please input three numbers:t”);

for(i=0;i

scanf(“%f%f%f”, &a,&b,&c);

printf(“%d ”,a[i]);

area = fun(a,b,c);

printf(“n”);

printf(“Area is: %.2fn”,area);

getch();

getch();} }

1、补充程序Ccon061.c,使其实现从键盘输入一个4行4列的二维整型数组表示4×4阶矩阵,并计算第1列元素之和。

如 输入:1 25 69 10 11 12 1

314 15 16

输出:282、补充程序Ccon062.c,使程序中的fun()函数用二分法在已按从小到大排好序的数组a中查找q,若找到则返回第一个q对应的下标,没找到返回-1。

3、补充程序Ccon063.c,使程序中的fun()函数判断输入的一个点(x,y)是否位于坐标在原点,半径为r(r>0)的圆内。Ccon062.c Ccon063.c

#include #include Ccon061.c

int fun(int a[],int n,/**/ int q /**/)#include #include

{ int fun(/**/ float r /**/,float x,float y)#include

int left,right,mid;{

int bIn;main()

left= 0;

bIn =/**/sqrt(x*x+y*y)/**/

right = n-1;

return bIn;

int i,/**/ j /**/;

while(left

int a[4][4],sum;

{ mid= /**/ left +(right-left)/2 /**/;main()

sum=/**/ 0 /**/;

{ float r=-1,x,y;

printf(“Please input 16 numbers:n”);

if(q

else if(q > a[mid])left = mid+1;

int bIn;

for(i=0;i

else return mid;

while(r

for(j=0;j

}

{printf(“Please input radius r(r>0):n”);

scanf(“%d”,&a[i][j]);

return-1;

scanf(“%f”, &r);

for(i=0;i

}

}

/**/

sum+=a[i][0];

/**/

main()

printf(“Please input the dot(x,y):n”);

printf(“%dn”,sum);

{ int a[]={3,4,6,11,17,22,31,45};

scanf(“%f%f”,&x,&y);

getch();

int k,n;

bIn = fun(r,x,y);}

n = sizeof(a)/sizeof(int);

if(bIn == 1)

k = fun(a,n,31);

printf(“in the circle!n”);

printf(“%dn”,k);

else

printf(“out of the Circle!n”);

getch();

getch();}

} abc计算这个三角形的面积(规定:若这三条边不能构成三角形,返回-1),2

填空

填空(每空1分,共26分) 1,《呐喊》,《彷徨》是 的小说集.2,周朴园是 的话剧 中的人物.3,吴荪甫是茅盾的小说《 》中的主人公.4,小说《檀香刑》的作者是 .5,中国文学理论史上......

填空

1、习近平在第二次中央新疆工作座谈会上指出,新疆的问题最长远的还是(民族团结)问题。2、新疆工作的“三个事关”:新疆局势关(全国改革发展稳定大局),事关(祖国统一、民族、国家安全......

填空

1、按照国家烟草专卖局《烟草专卖文明执法行为规范》的要求,需要检查店内带锁的抽屉、柜子时,要说(请您自己打开抽屉、柜子,保管好自己的钱物,让我们看一下)。2、经营烟草专卖品......

填空

填空1用户办理(停送电工作)的联系让人必须由(持)有效(进网停送电联系人资格证)的人员担任,用户变电站值班人员必须由(持)有效(调度运行值班合格证)的人员担任。调度机构只与持有有效(进......

填空

l.下列属于教育现象的是 ( C ): A.老猫教幼仔捕老鼠 B.老鸭教小鸭游水 C.影响人的身心发展为目标的活动 D.父母给孩子补充营养 2.下面对各阶段学前教育目标论述正确的是 (......

《C填空.docx》
将本文的Word文档下载,方便收藏和打印
推荐度:
C填空
点击下载文档
相关专题 c填空 c填空
[其他范文]相关推荐
[其他范文]热门文章
下载全文