03 2022 档案
摘要:源程序: #include <stdio.h> //求最大值的函数int highest(int m[3][4]) //形式参数是二维数组{ int a = m[0][0]; //认为第一个数是最大值 int i, j; for (i = 0; i < 3; i++) //外层循环控制行 { for
阅读全文
摘要:源程序: #include <stdio.h>int main(){ int upper=0,lower=0,digit=0,space=0,other=0,i=0; char *p,s[80]; printf("请输入一串字符,包括大写字母、小写字母、数字、空格和其他字符,不超过80个:\n");
阅读全文
摘要:源程序: #include <iostream>using namespace std; class birth{private: int year,month,day;public: birth(int x,int y,int z) { year=x; month=y; day=z; } void
阅读全文
摘要:源程序: #include <iostream>using namespace std; void sort(int L[],int n){ int j,k,flag,temp; flag=n-1; while(flag>0) { k=flag-1; flag=0; for(j=0;j<=k;j++
阅读全文
摘要:网络图: 路由器1 telnet 路由器2 抓包结果 :
阅读全文
摘要:网络图: R1配置: R2配置: R3配置: ping通情况: 抓包:
阅读全文
摘要:源程序: #include <stdio.h>void main(){ int array[10]; int *pointer; int i,j,t,max,min,sum=0; double aver; int num1=0,num2=0; pointer=array; //指针指向数组,数组名表
阅读全文
摘要:声明复数类Complex,该类中有两个私有变量real , image分别表示一个复数的实部和虚部。 为Complex类添加适当的构造函数,并使用友元函数 add实现复数加法。 #include <iostream>using namespace std; class Complex{private
阅读全文
摘要:源程序: #include <iostream>using namespace std; class Based{public: Based() { cout<<"Based构造函数\n"; fun(); } virtual void fun() { cout<<"Base::fun()函数\n";
阅读全文
摘要:源程序: #include <iostream>using namespace std; class example{private: int a;public: example(int b=5) { a=b++; } void print() { a=a+1; cout<<a<<" "; } vo
阅读全文
摘要:源程序: 要求输出结果为40 #include <iostream>using namespace std; class Test{ static int x; //程序填空public: Test(int i=0) { x=i+x; } int Getnum() { return Test::x+
阅读全文
摘要:源程序: #include <iostream>using namespace std; class line;class box{private: int color; int upx,upy; int lowx,lowy;public: friend int same_color(line l,
阅读全文
摘要:源程序: 下列程序,输出结果为150。 #include <iostream>using namespace std; class Arr{ int *a,n;public: Arr():a(0),n(0){} Arr(int *aa,int nn) { n=nn; a=new int [n]; f
阅读全文
摘要:源代码: #include <stdio.h>#include <stdlib.h>#define N 5 //函数与指针混合编程 void swap(int *pointer1, int *pointer2){ int temp; temp = *pointer1; *pointer1 = *po
阅读全文
摘要:网络图: 两个交换机的配置相似: S1的配置: S2的配置: 路由器R1的配置: 路由器R2的配置: 1和3测试 2和4测试
阅读全文
摘要://利用二维数组打印出如下杨辉三角形的前8行。 #include <stdio.h>#define N 8void main(){ int i, j, k, n=0, a[N][N]; /*定义二维数组a[8][8]*/ while(n<=0||n>=8){ /*控制打印的行数不要太大,过大会造成显
阅读全文
摘要:源程序: //定义一个5行5列的二维数组,然后从键盘上输入数据对数组进行初始化,//求出该二维数组的四周元素的和。 #include <stdio.h>void main(){ int a[5][5],s,s1,i,j; /* s用来存放所有元素的和,s1用来存放中间元素的和 */ s=s1=0;
阅读全文
摘要:源代码: //定义一个包含4行4列的二维整型数组,要求从键盘上输入数据对数组进行初始化,然后//求出该二维数组所有元素的和以及每一行元素的平均值 #include <stdio.h>void main(){ int sum,s,i,j,a[4][4]; float aver; printf("请输入
阅读全文
摘要:源程序: #include <iostream>using namespace std; int main(){ int max(int a,int b,int c=0); int a,b,c,m1,m2; cin>>a>>b>>c; m1=max(a,b,c); //程序填空 m2=max(a,b
阅读全文
摘要:源程序: #include <iostream>using namespace std; class toy{private: int num,price;public: toy(int q,int p) { num=q; price=p; } int get_num() { return num;
阅读全文
摘要:源程序: #include <iostream>using namespace std;int time=0,end=0;class Test{public: Test() { if(time==0) //程序填空 cout<<"欢迎使用测试程序!"<<endl; time=time+1; } ~T
阅读全文
摘要:源程序: #include <iostream>using namespace std; class Person{public: virtual void disp() { cout<<"Person "; }};class Address:public Person //程序填空{public:
阅读全文
摘要:源程序: #include <iostream>using namespace std; void fun(int *pa,int n); void SumArry(int *pa,int n){ for(int i=0;i<n-1;i++) *(pa+9)+=*(pa+i); //程序填空} vo
阅读全文
摘要:源程序: #include <stdio.h>void main(){ int a[11]={12,21,27,30,35,44,56,60,68,70}; int i,j,data; printf("请输入要插入到数组中的整数:\n"); scanf("%d",&data); if(data<=a
阅读全文
摘要:源程序: void main(){ int a[10]={12,38,35,22,97,65,50,88,9,75}; int i,j,t; //t是临时变量 for(j=1;j<=9;j++) //外层循环控制第几趟排序 { for(i=0;i<=10-j-1;i++) //内层循环是比较两个数的
阅读全文
摘要:源程序 #include <stdio.h>void main(){ int i; float A[10], min, max, avg=0; printf("输入10个学生的成绩:\n"); for (i = 0; i <= 9; i++) { printf("第%d个学生成绩:", i + 1)
阅读全文