更多"请补充main函数,该函数的功能是:输出方程组“A+B=56,A+2B"的相关试题:
[填空题]请补充main函数,该函数的功能是:输出一个3×3的矩阵,要求必须使用行指针表示输出变量。
注意;部分源程序给出如下.
请勿改动主函数main和其他函数中的任何内容,仅在 main函数的横线上填入所编写的若干表达式或语句。
试题程序:
#include<s tdio. h>
main( )
{
static int array[3] [3]={{9,8,7}, {6,5,
4}, (3,2,1}};
iht (*p) [3],j,i;
p=【1】
clrscr ( );
for (i=0; i<3; i++)
{
printf (" /n/n" );
for (j=0; j<3; j++)
printf("%4d", 【2】 );
}
}
[填空题]从键盘输入一组小写字母,保存在字符数组str中。请补充函数fun( ),该函数的功能是:把字符数组str中字符下标为奇数的小写字母转换成对应的大写字母,结果仍保存在原数组中。
例如,输入“acegikm”,输出“aCeGiKm”。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun( )的横线上填入所编写的若干表达式或语句。
试题程序:
#include <stdio.h>
#define N 80
void fun (char s[])
int i=0;
while ( 【1】 )
if (i%2!=0)
s[i]-= 【2】 ;
【3】 ;
main ( )
char str [N];
clrscr ( );
printf("/n Input a string:/n");
gets (str);
printf("/n*** original string ***/n");
puts (str);
fun (str);
printf ("In*** new string ***/n");
puts (str);
[填空题]从键盘输入一组小写字母,并保存在字符数组str中。请补充函数fun( ),该函数的功能是:把字符数组str中ASCII码为奇数的小写字母转换成对应的大写字母,结果仍保存在原数组中。
例如,输入“abcdefg”,输出“AbCdEfG”。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun( )的横线上填入所编写的若干表达式或语句。
试题程序:
#include<stdio.h>
#define N 80
void fun(char s[])
{
int i;
for( 【1】 ; 【2】 ;i++)
{
if( 【3】 )
s[i]-=32;
}
}
main( )
{
char str[N];
clrscr( );
printf("/n lnput a string:/n");
gets(str);
printf("/n*** original string ***/n");
puts (str);
fun (str);
printf("/n*** new string ***/n");
puts (str);
}
[填空题]请补充main( )函数,该函数的功能是:输出一个4×4的矩阵,要求必须使用行指针表示输出变量。
注意:部分源程序已给出。
请勿改动主函数main和其他函数中的任何内容,仅在main( )函数的横线上填入所编写的若干表达式或语句。
试题程序:
#include<stdlib.h>
#include<stdio.h>
void main( )
static int arr[4][4]=(9,8,7,6),
6,5,4,3,
3,2,1,0,
2,4,6,8;
int(*p)[4],j,i;
p= (1) ;
system("CLS");
for(i=0;i<4;i++)
printf("/n/n");
for(j=0;j<4;j++)
printf("%4d", (2) );
[填空题]请补充main函数,该函数的功能是:输出一个NXN矩阵,要求非周边元素赋值0,周边元素赋值1。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在 main函数的横线上填入所编写的若干表达式或语句。
试题程序:
#include<stdio .h>
#define N 10
main( )
int bb[N] IN];
iht i,j,n;
clrscr 0;
printf (" /nInput n: /n");
scanf ("%d", &n);
for (i=0; i<n; i++ )
for (j=0; j<n; j++)
if(【1】)
bb[i] [j]=l;
else
【2】;
printf(" /n*** the result *** /n");
for (i=0; i<n; i++)
printf (" /n/n");
for (j=0; j<n; j++)
printf ("%4d",bb [i] [j ] );
[填空题]请补充main函数,该函数的功能是:从键盘输入一组整数,使用条件表达式找出最大的整数。当输入的整数为0时结束。
例如,输入1,2,3,5,4,0时,最大的数为5。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在 main函数的横线上填入所编写出的若干表达式或语句。
试题程序:
#include<stdio.h>
#include<conio.h>
#define N 100
main( )
{
int num[N];
int i=-1;
int max=0;
clrscr( );
printf("/nInput integer number:/n");
do
{
i++;
printf("num[%d]=",i);
scanf("%d", 【1】 );
max= 【2】 num[i]:max;
}while ( 【3】 );
printf("max=%dkn",max);
}
[填空题]请补充main函数,该函数的功能是:从键盘输入一组字符串,以‘*’结束输入,并显示出这个字符串。
例如,输入abcdefghi*,结果显示adcdefghi。
注意:部分源程序给出如下.
请勿改动主函数main和其他函数中的任何内容,仅在 main函数的横线上填入所编写的若干表达式或语句。
试题程序:
#include<stdio. h>
#define N 80
main ( )
{
iht i=-l, j=0;
char str IN];
clrscr ( );
printf("/n Input a string /n");
do
{
i++;
scanf(【1】);
}while(【2】);
printf ("/n**display the string** /n");
while (j<i)
{
printf (【3】);
j++;
}
}
[填空题]请补充main函数,该函数的功能是:从键盘输入3个整数,然后找出最大的数并输出。
例如,输入:12,45,43,最大值为45。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在 main函数的横线上填入所编写的若干表达式或语句。
试题程序:
#include<stdio.h>
#include<conio.h>
main( )
int a, b, c, max;
clrscr( );
printf("/nlnput three numbers:/n");
scanf("%d,%d,%d",&a,&b,&c);
printf("The three numbers are:%d,
%d,%d/n",a,b,c);
if(a>b)
【1】 ;
else
【2】 ;
if(max<c)
【3】 ;
printf("max=%d/n",max);
[填空题]请补充main函数,该函数的功能是:从键盘输入3个整数,然后找出最大的数并输出。
例如,输入:12,45,43,最大值为45。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在 main函数的横线上填入所编写的若干表达式或语句。
试题程序:
#include<stdio.h>
#include<conio.h>
main( )
{
int a, b, c, max;
clrscr( );
printf("/nlnput three numbers:/n");
scanf("%d,%d,%d",&a,&b,&c);
printf("The three numbers are:%d,
%d,%d/n",a,b,c);
if(a>b)
【1】 ;
else
【2】 ;
if(max<c)
【3】 ;
printf("max=%d/n",max);
}
[填空题]请补充main函数,该函数的功能是:输出一个N×N矩阵,要求非对角线上的元素赋值为0,对角线元素赋值为1。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在 main函数的横线上填入所编写的若干表达式或语句。
试题程序:
#include<stdio. h>
#define N 10
main ( )
int bb[N] [N];
int i, j,n;
clrscr ( );
printf (" /nInput n:/n");
scanf ("%d", &n);
for (i=0; i<n; i++)
for (j=0; j<n; j++)
【1】 ;
if (i==j)
bb[i] [j]= 【2】 ;
if ( 【3】 )
bb[i] [j]=1;
printf(" /n***** the result ***** /n");
for (i=0; i<n; i++)
printf (" /n/n");
for (j=0; j<n; j++)
printf ("%4d",bb [i] [j] );