题目内容

下列给定程序的功能是:将N*N矩阵主对角线元素的值与反向对角线对应位置上元素的值进行交换。程序中有两处错误分别是[1]和[2]处,请将修改后正确语句写在试卷答题纸上#include #define N 4int main(){int t[N][N]={21,23,42,31,52,34,27,22,56,49,20,36,16,25,17,35},i,j,tmp; printf("\n原矩阵: \n"); for(i=0;i

查看答案
更多问题

在此程序中,函数fun的功能是,统计长整数的各位上出现数字1、2 3的次数,并用外部全局变量c1 c2 c3返回主函数。例如,当n=123114350时, 结果应该为: c1=3 c2=1 c3=2。#include int c1,c2,c3;void fun(long n){ c1=c2=c3=0; while(n) {/**********found**********/ switch(________ __) { case 1:/**********found**********/ ________ __;break; case 2:/**********found**********/ c2++;________ __ case 3: c3++; } n/=10; }}void main(){ long n=123114350L; fun(n); printf("\nThe result: \n"); printf("n=%ld c1=%d c2=%d c3=%d\n",n,c1,c2,c3); }

有以下程序 #includemain() { int a=3 ,b=3; printf("%d \n",a&b); } 程序运行后的输出结果是()。

A. 3
B. 1
C. 0
D. 6

若有定义,int a=3,*p=&a,**q=&p;,则以下叙述中错误的是( )。

A. q 是指针变量,*q 就是变量a
B. p 是指针变量,p 指向变量a
C. q 指向变量p,所以*q 指向变量a
D. *p 与**q 都代表变量a

有以下程序#include double fun(double a){ double x; x = a - (int)a; return x;}main( ){ double a = 3.1415; printf("%f\n", fun(a));}程序的运行结果是( )。

A. 0. 000000
B. 3.141500
C. 3.000000
D. 0. 141500

答案查题题库