题目内容

写出以下程序的运行结果。#include#define MAXN 100struct student{char name[20];int score;char grade;};void set_grade( struct student *p, int n );int main(){int i, n;struct student stu[MAXN];scanf("%d", &n);for(i = 0; i < n; i++){scanf("%s%d", stu[i].name, &stu[i].score);}set_grade(stu, n);for(i = 0; i < n; i++)printf("%s#%c\n", stu[i].name, stu[i].grade);return 0;}void set_grade(struct student *p, int n){struct student *q = p + n - 1;while(p <= q ){if ( p->score >= 60 )p->grade = 'P';elsep->grade = 'F';p++;}}运行程序时输入4zhao 60liu 75li 53wang 96第1行输出______。第2行输出______。第3行输出______。第4行输出______。

查看答案
更多问题

运行以下程序,输入5个数字,分别是1 3 5 7 9,写出程序的运行结果。#includeint main(void){const int n=5;int i;double average, sum;int a[n];printf("Enter %d integers: ",n);sum = 0;for(i =0; iaverage:");for(i = 0; i average)printf("%d ", a[i]);}printf("\n");return 0;}

运行以下程序,输入zoo,写出程序的运行结果。# include # include # define MAXLINE 100void encrypt ( char *s);int main (void){char line [MAXLINE];printf ("Input the string: ");gets(line);encrypt (line);printf ("%s\n", line);return 0;}void encrypt ( char *s){for ( ; *s != '\0'; s++)if (*s == 'z')*s = 'a';else*s = *s+1;}

运行以下程序,输入15 8 7 6 12,写出程序运行结果。#include void fun(int a[ ], int n);int main(void){int n, a[5];int i;for (i=0; i<5;i++)scanf("%d",&a[i]);fun(a,5);for (i=0; i<4; i++)printf("%d#",a[i]);printf("%d",a[4]);return 0;}void fun(int a[ ], int n){int i, j, t;for( i = 1; i < n; i++ )for (j = 0; j < n-i; j++ )if (a[j] > a[j+1]){t=a[j]; a[j]=a[j+1]; a[j+1]=t;}}

运行以下程序,输入21252,写出程序运行结果。#include int fun(int number, int digit);int main(void){int count, in;scanf("%d", &in);count = fun(in, 2);printf("%d#%d\n", in, count);return 0;}int fun(int number, int digit){int count;if(number < 0) number = -number;count = 0;do{if(number % 10 == digit) count++;number = number / 10;}while(number != 0);return count;}

答案查题题库