全国自考高级语言程序设计(一)精选试题及答案,内含单项选择题、填空题、程序分析题、程序填充题、程序设计题。
编写程序,要求输入两个数,比较大小,输出大数和小数(用指针实现)。
从键盘向一维数组中输入10个实数,计算并输出其最大值和平均值。
将20名学生的姓名和成绩由键盘输入,计算并输出平均成绩。
#include< stdio.h>
#define N 20
struct student{char name[20];
float score;
};
void main()
{
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语句。
相关试卷
管理信息系统2009年1月真题及答案
管理信息系统2009年10月真题及答
管理信息系统2010年1月真题及答案
管理信息系统2010年10月真题及答
管理信息系统2011年1月真题及答案
管理信息系统2011年10月真题及答
管理信息系统2012年4月真题及答案
管理信息系统2012年10月真题及答
管理信息系统2013年4月真题及答案
管理信息系统2013年10月真题及答