更多"下面程序的功能是将小写字母变成对应大写字母后的第二个字母。其中y变成A"的相关试题:
[填空题]下面程序的功能是将字符数组a中下标值为偶数的元素从小到大排列,其他元素不变,请填空。
#include<iostream.h>
#include<string.h>
void main( )
char a[ ] ="clanguage", t;
int I ,j, k;
k=strlen(a) ;
for(i=0;i<=k-2;i+=2)
for(j=i+2;j<=k; 9 )
if( 10 )
t=a[i] ;a[i] =a[j] ;a[j] =t;
cout < < a;
cout < < endl;
[填空题]下面程序有两个printf语句,如果第一个printf语句输出的是194,则第二个printf语句的输出结果是 【10】
main( )
int a[10]=1,2,3,4,5,6,7,8,9,0,*p;
p=a
printf("%x/n",p);
printf("%x/n",p+9);
[简答题]以下是某C程序段,其功能为计算1到所输入数字的逐步累加和,请仔细阅读程序并完成要求。
#include
int sum(int n )
int i,ret_sum;
ret_sum = 0;
for ( i = 1; i <= n; i++ )
ret_sum += i;
return ret_sum;
void main( )
int j,n;
printf("/1: Please input value here ==> ");
scanf("%d",&n);
for ( j = 1; j <= n; j++ )
printf("/2: from 1 to %d is %d/n",j,sum(j));
设计一组测试用例,使该程序所有函数的语句覆盖率和分支覆盖率均能达到100%。如果认为该程序的语句或分支覆盖率无法达到100%,需说明为什么。
[简答题]
以下是某C程序段,其功能是计算出某一天是一年中的第几天,请仔细阅读程序并完成要求。
#include
struct days
{
int year;
int month;
int date;
}day;
void main( )
{
struct
days *p;
int num=0, i;
int
m[13]={0,31,28,31,30,3l,30,3l,3l,30,31,30,31);
p=&day;
printf("please input the day:/n");
seanf("% d % d % d,
&(p->year), &(p->month),&(p->date));
for(i=0; i<(p->month);
i++)
num+=m[i];
num+=(p->date);
if((p->year)%4= =0&&(p>year)%100 !=0 || (p->year)%400==0)
if((p->>month)>2)
num++;
printf(" This
day is % d day in the year./n ", num);
}
[填空题]以下程序的功能是:将输入的正整数按逆序输出。例如:若输入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");
[简答题]下面程序是关于类的继承的用法。阅读下面程序,根据程序中的注释在每一条横线处填写一个语句,使程序的功能完整,且运行程序后的输出结果为:
I am parentclass!
I am childclass!
I am childclass!
注意:请勿改动main( )主方法和其他已有的语句内容,仅在下划线处填入适当的语句。
class Parent {
void printMe( ) {
System. out. println( "I am parentclass ! ");
}
}
class Child extends Parent {
void printMe( ) {
System. out. println( "I am childclass! ")
}
void printAll( ) {
______. printMe( ); //调用父类的方法
______. printMe( ); //调用本类的方法
printMe ( );
}
}
public class TestJieCheng {
public static void main(String args[]) {
______
myC. printAll( );
}
}