更多"以下程序运行时,输入的值在哪个范围才会有输出结果() #includ"的相关试题:
[填空题]以下程序运行时输出到屏幕的结果是 【7】。
#include
void main( )
{int i=1,m=0;
switch(i)
{ case 1:
case 2: m++;
case 3: m++;
}
printf("%d",m);
}
[填空题]以下程序在运行时若输入:1234567,则程序的运行结果是______。
#include<stdio.h>
main( )
int x, y;
scanf("%2d%1d", &x, &y); printf("%d/n", x+y);
[填空题]以下程序运行时若从键盘输入:10 20 30<回车>。输出结果是______。
#include <stdio.h>
main( )
int i=0,j=0,k=0;
scanf("%d%*d%d",&i,&j,&k);
printf("%d %d %d/n",i,j,k);
[填空题]在以下程序运行时若从键盘输入:10 20 30<回车>,输出结果是______。
#include<stdio.h>
main( )
int i=0, j=0, k=0;
scanf("%d%*d%d", &i, &j, &k);
printf("Gd%d%d/n", i, j, k);
[简答题]以下程序运行时输入: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);
}
[填空题]
以下程序运行时输出结果是()。
#include
#include
int count(char s[])
{ int i=0;
if(s[i]==’/0’) return 0;
while(isalpha(s[i]))i++;
while(!isalpha(s[i])&&s[i]!=’/O’)i++;
return 1+count(&s[i]);
}
void main( )
{char line[]="one world,one dream.";
printf("%d",count(line));
}
[填空题]以下程序运行时输出到屏幕的结果是【16】 。
#include
#include
void main( )
{ int i=0,n=0;char s[80],*p;
strcpy(s,"It is a book.");
for(p=s;p!=’/0’;p++)
if(*p==’ ’)
i=0;
else
if(i==0)
{n++;i=1; }
printf("%d/n",n);
}
[填空题]以下程序运行时输出到屏幕的结果是【10】。
#include
int fun(int *x,int n)
{if(n==0) return x[0];
else return x[0]+fun(x+1,n-1);
}
void main( )
{int a[ ]={1,2,3,4,5,6,7};
printf("%d/n",fun(a,2));
[填空题]以下程序运行时输出到屏幕的结果是【6】 。
#include
void main( )
{FILE *fp;
int k,n,a[6]={1,2,3,4,5,6};
fp=fopen("d2.dat","w"); ’
fprintf(fp,"%d%d%d/n",a[0],a[1],a[2]);
fprintf(fp,"%d%d%d/n",a[3],a[4],a[5]);
fclose(fp);
fp=fopen("d2.dat","r");
fscanf(fp,"%d%d",&k,&n);
printf("%d,%d/n",k,n);
fclose(fp);
}
[填空题]以下程序运行时输出到屏幕的结果是【11】 。
#include
long f(int n)
{static long s;
if(n==1) return s=2;
else return ++s;
}
void main( )
{long i,sum=0;
for(i=1;i<4;i++,) sum+=f(i);
printf("%ld",sum);
}
[单项选择]若运行时给变量x赋值12,则以下程序的运行结果是()。
#include<stdio.h>
main( )
int x,y;
scanf("%d",&x);
y=x>12 x+10:x-12;
printf("%d/n",y);
A. 0
B. 22
C. 12
D. 10
[填空题]以下程序运行时,输出到屏幕的结果是__(9)___
#include
#include
void f(char s[],char t[])
{
int i,m=strlen(t),k;
for(i=0;s[i]!=’/0’;i++)
if(s[i]>=’a’&& s[i]<=’z’)
{
k=t[i%m]-’0’;
s[i]=(s[i]-’a’+k)%26+’a’;
}
}
int main( )
{
char s1[10]="Be2013";
f(s1, "123");
puts(s1);
return 0;
}
[填空题]
以下程序运行时输出到屏冪的结果中第一行是(),第二行是()。
#include
#include
Void compute(char*s)
{int t,r,
Char op;
For(r=0;isdigit(*s);s++) /*isdigit(*s)判断S指向的字符是否为数字字符*/
R=r*10+*s-‘0’;
While(*s)
{op=*s++;
For(t=0;isdigit(*s);s++)
T=t*10+*s-‘0’;
Switch(op)
{case’+’:r=r+t;break;
Case’-’:r=r-t;break;
Case’*’:r=r*t;break;
Case’/’:if(t)r=r/t;
else{puts(devide enor);return;}
}
}
Printf(%d/n,r);
}
Void main( )
{
compute(12+6-19+2);
Compute(12/6*19/2);
}
[填空题]
以下程序运行时输出结果是()
#include
void main( )
{double x[3]={1.1,2.2,3.3},Y;
FILE *fp=fopen("d://a.out","wb+");
fwrite(x,sizeof(double),3,fp)"
fseek(fp,2L*sizeof(double),SEEK_SET);
fread(&y,sizeof(double),1,fp)"
printf("%.1f",y);
fclose(fp)"
}
[填空题]
以下程序运行时输出结果是()。
#include
void change(int x,int Y,int *z)
{ int t;
t=x;x=y;y=*z;*z=t;
}
void main( )
{ int x=18,y=27,z=63;
change(x,y,&z);
printf("x=%d,y=%d,z=%d/n",x,y,z);
}
[填空题]
下列程序运行时,若输入labcedf2df<回车>输出结果为()。
#include<stdio.h>
main( )
{ char a=0,ch;
while((ch==getchar( ))!=’/n’)
{ if(a%2!=0&&(ch>=’a’&&ch<=’z’)) ch=ch’a’+’A’;
a++;prtchar(ch);
}
printf("/n");
}