未分类题

以下程序的功能是输出如下形式的方阵:
13 14 15 16
9 10 11 12
5 6 7 8
1 2 3 4
请填空。
include <stdio.h>
main( )
{ int i,j,x;
for(j =4;j 【 】;j--)
{ for(i = 1 ;i<=4;i++)
[ x=(j-1) *4+【 】;
printf( '%4d' ,x);
}
printf(' /n' );
}

A.h>
main(

【参考答案】

>=1或>0 i
>=1或>0 i 解析:程序的外层for循环控制输出数据的行数,故第一处填“>=1”或“>0”......

(↓↓↓ 点击下方‘点击查看答案’看完整答案 ↓↓↓)
热门 试题

未分类题
阅读以下程序说明和C++程序,将程序段中(1)~(5)空缺处的语句填写完整。【说明】以下【C++程序】实现一个简单的小型复数类MiniComplex,该复数类能进行输入、输出、复数的加法、减法、乘法和除法运算,还可以进行复数的相等比较。【C++程序】ifndef H_MiniComplexdefine H_MiniComplexinclude <iostream>using namespace std;class MiniComplex{public: 重载流插入和提取运算符(1) ostream&operator<<(ostream &osObject,const MiniComplex&complex){osObject<<'('<<complex.realPart<<'+'<<complex.imagPart<<'i'<<')';return osObject;}(2) istream&operator>>(istream&isObject, MiniComplex&complex){char ch;isObject >>complex.realPart>>ch>>complex.imagPart>>ch;return isObject;}MiniComplex(double real=0,double imag=0); 构造函数MiniComplex operator+(const MiniComplex&otherComplex)const; 重载运算符+MiniComplex operator-(const MiniComplex&otherComplex)const; 重载运算符-MiniComplex operator*(const MiniComplex&otherComplex)const; 重载运算符*MiniComplex operator (const MiniComplex&otherComplex)const; 重载运算符 bool perator==(const MiniComplex&otherComplex)const; 重载运算符==private :double (3);double imagPart;};end ifinclude 'MiniComplex.h'bool MiniComplex::operator==(const MiniComplex&otherComplex)const{return(realPart==otherComplex.realPart&&imagPart==ortherComplex.imagPart);}MiniComplex::MiniComplex(double real,double imag){realPart== real; imagPart==imagPart;}MiniComplex MiniComplex::operator+(const MiniComplex&otherComplex)const{MiniComplex temp;temp.realPart = realPart+ortherComplex. realPart;temp.imagPart = imagPart +ortherComplex. imagPart;return temp;}(4){ MiniComplex temp;temp.realPart= realPart-ortherComplex. realPart;temp.imagPart = imagPart-ortherComplex. imagPart;return temp;}MiniComplex MiniComplex::operator*(const MiniComplex&otherComplex)const{MiniComplex temp;temp.realPart = (realPart*ortherComplex. realPart)-(imagPart *ortherComplex.imagPart);temp.imagPart = (realPart*ortherComplex. imagPart)+(imagPart *ortherComplex.realPart);return temp;}MiniComplex MiniComplex::operator (const MiniComplex&otherComplex)const{MiniComplex temp;float tt;tt=1 (ortherComplex.realPart*ortherComplex.realPart+ortherComplex.imagPart *ortherComplex. imagPart);temp.realPart=((realPart*ortherComplex, realPart)+(imagPart *ortherComplex. imagPart))*tt;temp.imagPart =((imagPart *ortherComplex. realPart)-(realPart*ortherComplex. imagPart))*tt;return temp;}include <iostream>include <MiniComplex.h>using namespace std;int main(){MiniComplex numl(23, 34),num2(56, 35);cout<<'Initial Value of num1='<<num1<<' n Initial Value of num2='<<num2<<end1;cout<<num1<<'+'<<num2<<'='<<num1+num2<<end1; 使用重载的加号运算符cout<<num1<<'-'<<num2<<'='<<num
填空题