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 阅读全文
posted @ 2022-03-30 23:40 bobo哥 阅读(278) 评论(0) 推荐(0) 编辑
摘要:源程序: #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"); 阅读全文
posted @ 2022-03-28 17:33 bobo哥 阅读(1950) 评论(0) 推荐(0) 编辑
摘要:源程序: #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 阅读全文
posted @ 2022-03-27 11:36 bobo哥 阅读(42) 评论(0) 推荐(0) 编辑
摘要:源程序: #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++ 阅读全文
posted @ 2022-03-27 11:18 bobo哥 阅读(69) 评论(0) 推荐(0) 编辑
摘要:网络图: 路由器1 telnet 路由器2 抓包结果 : 阅读全文
posted @ 2022-03-24 17:39 bobo哥 阅读(96) 评论(0) 推荐(0) 编辑
摘要:网络图: R1配置: R2配置: R3配置: ping通情况: 抓包: 阅读全文
posted @ 2022-03-24 17:20 bobo哥 阅读(73) 评论(0) 推荐(0) 编辑
摘要:源程序: #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; //指针指向数组,数组名表 阅读全文
posted @ 2022-03-24 09:33 bobo哥 阅读(80) 评论(0) 推荐(0) 编辑
摘要:声明复数类Complex,该类中有两个私有变量real , image分别表示一个复数的实部和虚部。 为Complex类添加适当的构造函数,并使用友元函数 add实现复数加法。 #include <iostream>using namespace std; class Complex{private 阅读全文
posted @ 2022-03-20 15:12 bobo哥 阅读(96) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <iostream>using namespace std; class Based{public: Based() { cout<<"Based构造函数\n"; fun(); } virtual void fun() { cout<<"Base::fun()函数\n"; 阅读全文
posted @ 2022-03-20 14:58 bobo哥 阅读(55) 评论(0) 推荐(0) 编辑
摘要:源程序: #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 阅读全文
posted @ 2022-03-20 14:49 bobo哥 阅读(65) 评论(0) 推荐(0) 编辑
摘要:源程序: 要求输出结果为40 #include <iostream>using namespace std; class Test{ static int x; //程序填空public: Test(int i=0) { x=i+x; } int Getnum() { return Test::x+ 阅读全文
posted @ 2022-03-20 11:47 bobo哥 阅读(50) 评论(0) 推荐(0) 编辑
摘要:源程序: #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, 阅读全文
posted @ 2022-03-20 11:40 bobo哥 阅读(40) 评论(0) 推荐(0) 编辑
摘要:源程序: 下列程序,输出结果为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 阅读全文
posted @ 2022-03-20 11:16 bobo哥 阅读(44) 评论(0) 推荐(0) 编辑
摘要:源代码: #include <stdio.h>#include <stdlib.h>#define N 5 //函数与指针混合编程 void swap(int *pointer1, int *pointer2){ int temp; temp = *pointer1; *pointer1 = *po 阅读全文
posted @ 2022-03-17 18:41 bobo哥 阅读(54) 评论(0) 推荐(0) 编辑
摘要:网络图: 两个交换机的配置相似: S1的配置: S2的配置: 路由器R1的配置: 路由器R2的配置: 1和3测试 2和4测试 阅读全文
posted @ 2022-03-16 22:16 bobo哥 阅读(327) 评论(0) 推荐(0) 编辑
摘要://利用二维数组打印出如下杨辉三角形的前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){ /*控制打印的行数不要太大,过大会造成显 阅读全文
posted @ 2022-03-09 22:48 bobo哥 阅读(51) 评论(0) 推荐(0) 编辑
摘要:源程序: //定义一个5行5列的二维数组,然后从键盘上输入数据对数组进行初始化,//求出该二维数组的四周元素的和。 #include <stdio.h>void main(){ int a[5][5],s,s1,i,j; /* s用来存放所有元素的和,s1用来存放中间元素的和 */ s=s1=0; 阅读全文
posted @ 2022-03-09 22:38 bobo哥 阅读(101) 评论(0) 推荐(0) 编辑
摘要:源代码: //定义一个包含4行4列的二维整型数组,要求从键盘上输入数据对数组进行初始化,然后//求出该二维数组所有元素的和以及每一行元素的平均值 #include <stdio.h>void main(){ int sum,s,i,j,a[4][4]; float aver; printf("请输入 阅读全文
posted @ 2022-03-09 22:27 bobo哥 阅读(165) 评论(0) 推荐(0) 编辑
摘要:源程序: #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 阅读全文
posted @ 2022-03-07 20:11 bobo哥 阅读(35) 评论(0) 推荐(0) 编辑
摘要:源程序: #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; 阅读全文
posted @ 2022-03-06 11:53 bobo哥 阅读(34) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <iostream>using namespace std;int time=0,end=0;class Test{public: Test() { if(time==0) //程序填空 cout<<"欢迎使用测试程序!"<<endl; time=time+1; } ~T 阅读全文
posted @ 2022-03-06 11:45 bobo哥 阅读(26) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <iostream>using namespace std; class Person{public: virtual void disp() { cout<<"Person "; }};class Address:public Person //程序填空{public: 阅读全文
posted @ 2022-03-06 11:17 bobo哥 阅读(33) 评论(0) 推荐(0) 编辑
摘要:源程序: #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 阅读全文
posted @ 2022-03-06 11:03 bobo哥 阅读(31) 评论(0) 推荐(0) 编辑
摘要:源程序: #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 阅读全文
posted @ 2022-03-03 11:45 bobo哥 阅读(634) 评论(0) 推荐(0) 编辑
摘要:源程序: 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++) //内层循环是比较两个数的 阅读全文
posted @ 2022-03-03 11:28 bobo哥 阅读(92) 评论(0) 推荐(0) 编辑
摘要:源程序 #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) 阅读全文
posted @ 2022-03-03 08:05 bobo哥 阅读(2002) 评论(0) 推荐(0) 编辑