更多"若输入“abcdef”、“abdef”,以下程序的输出结果为( )。"的相关试题:
[填空题]下列程序运行时,若输入1abcdef2df<回车>,输出结果为______。
#include<stdio.h>
void main( )
char a=0,ch;
while((ch=getchar( ))!=’/n’)
if(a%2!=0&&(ch>=’a’&&ch<=’z’))ch=ch-’a’+’A’;
a++;putchar(ch);
printf("/n");
[单项选择]若输入bcdefgh、m、abcdefg,以下程序的输出结果为( )。 #include<stdio.h> #include<string.h> main( ) { int i; char string[20],str[3][20]; for(i=0;i<3;i++)gets(str[i]); if(strcmp(str[0],str[1])>0) strcpy(string,str[0]); else strcpy(string,str[1]); if(strcmp(str[2],string)>0) strcpy(string,str[2]); printf("%s",string); }
A. bcdefgh
B. m
C. abcdefg
D. bcdefgh或abcdefg
[填空题]以下程序运行后输入:4,abcdef<回车>,则输出结果是______。
#include<stdio.h>
#include<string.h>
move(char*str,int n)
{ char temp;int i;
temp=str[n-1];
for(i=n-1;i>0;i--)
str[i]=str[i-1];
str[0]=temp;
}
main( )
{ char s[50];int n,i,z;
scanf("%d,%s",&n,s);
z=strlen(s);
for(i=1;i<n;i++)
move(s,z);
printf("%s/n",s);
}
[单项选择]以下程序运行后,如果从键盘上输入ABCDEF<回车>,则输出结果为______。
#include<stdio.h>
#include<string.h>
func(char str[])
int num=0;
while(*(str+num)!=’/0’) num++;
return(num);p
main( )
char str[10],*p=str;
gets(p);printf("%d/n",func(P));
A. 8
B. 7
C. 6
D. 5
[单项选择]在执行以下程序时,如果从键盘上输入ABCdef<回车>,则输出为______。
#include <stdio.h>
main ( )
char ch;
while ((ch=getchar( ))!="/n")
if (ch>=’A’&& ch<=’B’)ch=ch+32;
else if (ch>=’a’&& ch<=’z’)ch=ch-32;
printf("%c",ch);
printf("/n");
A. ABCdef
B. abcDEF
C. abc
D. DEF
[填空题]以下程序的功能是:将输入的正整数按逆序输出。例如:若输入135则输出531。请填空。
#include <stdio.h>
main( )
int n,s;
printf("Enter a number:");scanf("%d",&n);
printf("Output:");
do
s=n%10;printf("%d",s);______;
while(n! =0);
printf("/n");
[填空题]以下程序的功能是:将输入的正整数按逆序输出。例如:若输入135则输出531。请填空。
#include <stdio.h>
main( )
{ int n,s;
printf("Enter a number:");scanf("%d",&n);
printf("Output:");
do
{ s=n%10;printf("%d",s);______;
}while(n! =0);
printf("/n");
}
[填空题]以下程序的功能是:将输入的正整数按逆序输出。例如:若输入135则输出531。请填空。
#include
main( )
{ int n,s;
prinff("Enter a number:");scanf("%d",&n);
printf("output: ");
do
{ S=n%10;printf("%d",s).【 】;}
while(n!=O);
printf("\n");
}
[填空题]以下程序的功能是:将输入的正整数按逆序输出。例如:若输入135则输出531,请填空。
#include
main( )
int n,s;
printf("Enter a number:"); scanf("%d",&n);
printf("Output: ");
do
s=n%10; printf("%d",s); ______;
while(n!=0);
printf("/n");
[填空题]以下程序运行后输入“abcdef<回车>”,则输出结果是______。
#include<stdio.h>
#include<string.h>
void fun(char *str)
{ char temp; int n, i;
n=strlen(str);
temp=str[n-1];
for(i=n-1; i>0; i--) str[i]=str[i-1];
str[0]=temp;
}
main( )
{ char s[50];
scanf("%s", s); fun(s); printf("%s/n", s);
}
[填空题]下列程序的功能是:将输入的正整数按逆序输出。例如:若输入135则输出531。请填空。
#include<stdio.h>
main( )
int n,s;
printf("Enter a number:");scanf("%d",&n);
printf("Output:");do
s=n%10;printf("%d",s); ______;
while(n!=0);printf("/n");
[单项选择]8位D/A转换器,当输入数字量10000000时输出电压为5V,若输入为10001000,输出电压为()V。
A. 5.44
B. 5.76
C. 6.25
D. 6.84
[简答题]下列给定程序中函数fun的功能是:计算正整数num各位上的数字之积。
例如,若输入252,则输出应该是20。若输入202,则输出应该是0。
请改正程序中的错误,使它能得出正确的结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构!
试题程序:
#include <stdio.h>
#include <conio.h>
long fun(long mum)
/********** found********** /
long k;
do
k*=num% 10;
/********** found********** /
num/=10;
while(mum);
return(k);
main( )
long n;
printf("/n please enter a number: ");
scanf("%ld", &n);
printf("/n% ld/n", fun(n));