运行下列程序后,输出结果是()
void fun(int x,int y,int *cp,int *dp)
{
*cp=x+y;*dp=x-y
}
void main()
int a=6, b=2;
fun(a+b,a-b, &a,&b);
printf("%d,%d\n",a,b);
编写程序,要求输入两个数,比较大小,输出大数和小数(用指针实现)。
从键盘向一维数组中输入10个实数,计算并输出其最大值和平均值。
将20名学生的姓名和成绩由键盘输入,计算并输出平均成绩。
#include< stdio.h>
#define N 20
struct student{char name[20];
float score;
};
struct student s[N]
int i;
float average=________;
for(i=0;i<N;i++)
scanf("%s%f", s[i]. name, &s[i]. score);
average+=________;
average=________;
printf("average =%7.2f\n",average);
以下程序的功能是将无符号八进制数字构成的字符串转换为十进制整数。
#include< stdio.h>
#include< string.h>
main()
char s[6], *p________;
int n;
gets(p);
n=*p-________;
while(________p!='\0')
n=n*8+*p-'0';
printf("%d\n",n);
struct node
char name[20]
int age;}
;void fun1( struct node s)
struct node n={"zhangsan", 23}
s=n;
void fun2 (struct node *t)
struct node n ={"lisi", 24};
*t=n;
int main(void)
struct node stu1={" wangwu",25},stu2={"zhaoliu",26};
Fun1 (stu1);
fun2(&stu2);
printf("%d, %d\n", stu1. age, stu2. age);
return 0;
#include<stdio.h>
func(int y)
static int x =0;
x+=y;
printf("%,d", x);
int a=5;
func(a);
以下程序的功能为:从键盘输入若干学生的成绩,计算出平均值,并输出低于平均值的学生成绩,输入为负数时结束输入。
#include <stdio.h>
float x[200],sum=0.0,ave,a;
int n=0,i;
printf("Please input the mark: \n");
scanf("%f", &a);
while(a>=0.0&&n<200)
sum+=_______;
x[n]=a;
n++;
ave=_______;
printf("OUTPUT: \n");
printf("ave =%f\n",ave);
for(i=0;i<n;i++)
if_______
printf("%f\n", x[i]);
#define A2
#define B(x) A*x/2
float c,a=6;
c=B(a);
printf("%.lf\n",c);
void f( int x, int *y)
{*y+=++x;}
int a=7,b=8;
f(a,&b);
printf("a=%d, b =%d\n",a,b);
C语言中,实现单分支选择结构的是_______语句,实现双分支选择结构的是if-else语句。
热门试卷
经济师初级(经济基础知识)模拟试卷5
经济师初级经济基础知识(商品经济的基
经济师(初级)工商管理专业知识与实务
初级经济师试题及答案3(公路运输)
经济师初级人力资源管理专业知识与实务
初级经济师《工商专业》全真模拟试卷(
初级经济师《经济基础知识》考前突破试
订单号:
遇到问题请联系在线客服