更多"输入100名学生的出生月份,统计并输出每个月份过生日的学生人数。
"的相关试题:
[单项选择]有以下程序:
# include <stdio.h>
# include <stdio.h>
void fun(int *p1, int *p2; int*s)
s=(int*) malloc(sizeof(int));
*s=*p1+*p2;
free(s);
main( )
int a=1,b=40,*q=&a;
fun(&a,&b,q);
printf("%d/n",*q);
程序运行后的输出结果是( )。
A. 42
B. 0
C. 1
D. 41
[简答题]输入数据:2743<回车>。
#include<stdio.h>
main( )
{int c;
while((c=getchar( ))!=’n’)
{switch(c-’2’)
{case 0:
case 1:putchar(c+4);
case 2:putchar(c+4);break;
case 3:putchar(c+3);
case 4:putchar(c+2);break;}
}
printf("/n");}
[简答题]输入数据:2743<回车>。
#include<stdio.h>
main( )
int c;
while((c=getchar( ))!=’n’)
switch(c-’2’)
case 0:
case 1:putchar(c+4);
case 2:putchar(c+4);break;
case 3:putchar(c+3);
case 4:putchar(c+2);break;
printf("/n");
[填空题]输出若干学生3门课程的成绩。
#include <stdio.h>
【9】
struct student
int num;
float score[3];
main ( )
int i=0, n;
float a[3];
【10】 *ptr [200];
printf ("请输入学生学号和3门课成绩,学号为0表示数据输入结束/n");
do
ptr[i]=(struct student *)malloc(sizeof(struct student));
scanf("%d%f%f%f",&ptr[i]->num,&a[O],&a[1],&a[2]);
ptr[i]->score[O]=a[O];
ptr[i]->score[1]=a[1];
ptr[i]->score[2]=a[2];
if( 【11】 ) break;
i++;
while(1);
n=i-1;
【12】 ;
for(i=O;i<=n;i++)
printf("%-6d%.1f %.1f %.1f/n",ptr[i]->num, ptr[i]->score[0],
ptr[i]->score[1], ptr[i]->score[2]);
[单项选择]执行以下程序时输入1234567<CR>,则输出结果是
#include <stdio.h>
main( )
int a=1,b;
scanf("%3d%2d",&a,&b);
printf("%d%d/n",a,b);
A. 12367
B. 12346
C. 12312
D. 12345
[简答题]/*设从键盘输入:420<回车>*/
#include<stdio.h>
main( )
char c;
while((c=getchar( ))!=’/n’)
switch(C-’0’)
case 0:
case 1:putchar(c+2);
case 2:putchar(c+3);break;
case 3:putchar(c+4);
default:putchar(c+1);break;
printf("/n");
[填空题]输入字母a时,下列程序的运行结果为 【3】 。
#include <stdio.h>
main( )
char ch;
ch=getchar( );
(ch>=’a’&&ch<=’z’)putchar(ch+’A’-’a’):putchar(ch);
[简答题]以下程序运行时输入:12<回车>,执行后输出结果
#include<stdio.h>
main( )
{char ch1,ch2;int n1,n2;
ch1=getchar( );ch2=getchar( );
n1=ch1-’0’;n2=n1*10+(ch2-’0’);
printf("%d/n",n2);
}
[填空题]
执行以下程序时输入1234567<CR>,则输出结果是 【6】 。
#include <stdio.h>
main( )
{ int a=1,b;
scanf("%2d%2d",&a,&b); prinff("%d %dhn",a,b);
}
[单项选择]当输入为"Fool&Swalow"时,下面程序的执行结果是( )。
#include<stdio.h>
main( )
char c;
while(c!='')
c=getchar( );
putchar(C) ;
A. Swalow
B. Fool
C. Fool
D. Swalow
[填空题]设有下列程序:
#include<stdio.h>
#include<string.h>
main( )
{ int i;
char si 10],ti 10];
gets(t);
for(i=0;i<2;i++)
{ gets(s);
if(strcmp(t,s)<0)strcpy(t,s);
}
printf("%s/n",t);
}
程序运行后,从键盘上输入(<CR>代表回车符):CDEF<CR>BADEF<CR>QTHRG<CR>,则程序的输出结果是______。
[简答题]#include<stdio.h>
#include<string.h>
void main( )
{
char*pa,a[20]="Beijing2008";
for(pa=a+7;*pa!=’/0’;pa++)putchar(*pa);
putchar(’/n’):
}
[单项选择]以下程序
#include<stdio.h>
#include<string.h>
main( )
char*pl="abc",*p2="ABC",str[50]="xyz";
strcpy(str+2.strcat(p1,p2));
printf("%s/n,str);
的输出是______。
A) xyzabcABC B) zabcABC
C) yzabcABC D) xyabcABC
[单项选择]运行下面程序时,从键盘输入字母H,则输出结果是
#include<stdio.h>
main( )
char ch;
ch=getchar( );
switch(ch)
case ’H’:printf("Hello!/n");
case ’G’:printf("Good morning!/n");
default:printf("Bye_Bye!/n");
A. Hello!
B. Hello!
C. Hello!
D. Hello!
[单项选择]运行下面的程序时,从键盘输入字母H,则输出结果是
#include <stdio.h>
main( )
char ch;
ch=getchar( );
switch(ch)
case 'H':printf("Hello!/n");
case 'G':printf("Good moming!/n");
default:printf("Bye_Bye!/n");
A. Hello!
B. Hello!
C. Hello!
D. Hello!
[填空题]设有下列程序:
#include<stdio.h>
#include<string.h>
main( )
int i;
char si 10],ti 10];
gets(t);
for(i=0;i<2;i++)
gets(s);
if(strcmp(t,s)<0)strcpy(t,s);
printf("%s/n",t);
程序运行后,从键盘上输入(<CR>代表回车符):CDEF<CR>BADEF<CR>QTHRG<CR>,则程序的输出结果是______。
[填空题]#include<stdio.h>
#include<conio.h>
main( )
{
int i,j;
int sum,k=0;
for(i=0;i<5;i++);
{
printf("input a number:");
scanf("%d",k);
sum+=k:
}
printf("the sum is%d",sum);
}
错误:______
改正:______