第4题
下面程序的功能是:根据输入的整数x和n,利用函数fact实...
下面程序的功能是:根据输入的整数x和n,利用函数fact实现求
。 例如:输入:2,3 输出
=8 请在程序中的横线上填入正确的内容,将程序补充完整。 /* c7-1.c 利用函数fact实现求x的n次方*/ #include "stdio.h" int main() { long int fact(long x,long n) ; /*声明fact函数*/ long int x ; long int n; printf("please enter X and N(>=0): "); scanf("%ld,%ld", &x, &n ); printf("%ld,%ld=%ld",x,n, (1) ); /*调用fact函数 */ return 0; } long int fact(long int x, long int n) /*定义fact函数求xn */ { long int i,s; (2) ; /*求累积变量的初始化*/ if (n= =0) return 0; for(i=1; i<=n; i++) *用循环实现xn* s="s*x;" (3) ; *返回结果xn*>
点击查看答案
第7题
已知程序功能为:为图形中不同行的矩形填充颜色,要求一行中矩形颜色相同。请在程序空档出选择填写正确语句: int [ ][ ]myRect = { {10,10}, {10,20}, {10,30},{10,40}, {20,10}, {20,20}, {20,30},{20,40}, {30,10}, {30,20}, {30,30},{30,40}, {40,10}, {40,20}, {40,30},{40,40} }; int [ ][ ]myColor = { {187, 255,255},{0,205, 205},{0,139, 139},{82,139, 139} }; void setup() { size(400,600); background(220); } void draw() { int i=0; int col; background(220);//刷新屏幕显示 for(i=0;i<=15;i++) { col=i%4; //填色 rect(myRect[i][0],myRect[i][1],10,10); } } }
A.fill(myColor[col][0],myColor[col][1],myColor[col][2]);
B.fill(myColor[0][col],myColor[1][col],myColor[2][col]);
C.fill(myColor[col][0],myColor[1][col],myColor[col][2]);
D.fill(myColor[0][col],myColor[col][1],myColor[2][col]);
点击查看答案
第9题
设有定义:double(*f)(inta,floatb,doublec),那么能够被指针变量f指向函数的原型是()。
A.doublefun1(inta,intb,intc)
B.doublefun2(floata,intb,doublec)
C.intfun3(inta,floatb,doublec)
D.doublefun4(int,float,double)
点击查看答案