12 2020 档案

摘要:源程序: class Point{ int x,y; Point(int a,int b) { x=a; y=b; } void show() { System.out.print(x+" "); System.out.print(y+" "); System.out.println(); //换行 阅读全文
posted @ 2020-12-29 20:56 bobo哥 阅读(124) 评论(0) 推荐(1) 编辑
摘要:源程序: #include <iostream>using namespace std; class Base1{public: Base1() { b1=6; } Base1(int i) { b1=i; } int get1() { return b1; }private: int b1;}; 阅读全文
posted @ 2020-12-28 21:04 bobo哥 阅读(96) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <iostream>using namespace std;class Point{private: int X,Y;public: Point(int a=0,int b=0) { X=a; Y=b; cout<<"Initializing……"<<endl; } Po 阅读全文
posted @ 2020-12-28 20:13 bobo哥 阅读(187) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <iostream>using namespace std;class Point //基类,也叫父类{protected: int x,y;public: Point(int a,int b) { x=a; y=b; } void show() { cout<<"x=" 阅读全文
posted @ 2020-12-28 19:31 bobo哥 阅读(134) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <iostream>#include <iomanip>using namespace std;int main(){ int x,i,j,arr[7]; freopen("d:\\cccccc\\input.txt","r",stdin); for(i=0;i<7;i+ 阅读全文
posted @ 2020-12-27 20:13 bobo哥 阅读(86) 评论(0) 推荐(0) 编辑
摘要:#include <stdio.h>#include <stdlib.h>#include <string.h>void StringCopy(char* strSource, char* strDestination){ int i = 0; while(*strSource!='\0') { * 阅读全文
posted @ 2020-12-15 22:23 bobo哥 阅读(631) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <iostream>using namespace std; class CCount //定义类CCount{public: CCount(void); //构造函数 ~CCount(void); //析构函数 int GetCount(void); //成员函数 vo 阅读全文
posted @ 2020-12-15 21:19 bobo哥 阅读(182) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <iostream>using namespace std; //定义类的模板class A //类的定义{private: int x,y; const int z;public: //A(){}; //缺省的构造函数 A(int a,int b,int c):x(a) 阅读全文
posted @ 2020-12-15 21:06 bobo哥 阅读(113) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <stdio.h>#include <string.h>#include <malloc.h> char *GetMemory(int num){ char *p=(char *)malloc(sizeof(char)*num); return p;} void main 阅读全文
posted @ 2020-12-15 20:48 bobo哥 阅读(109) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <stdio.h>#include <malloc.h> struct Student //结构体{ int sid; //学号 int age; //年龄}; struct Student *CreateStudent(){ struct Student *stu=(s 阅读全文
posted @ 2020-12-15 20:40 bobo哥 阅读(208) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <stdio.h>#include <stdlib.h>#include <string.h>void StringCopy(char *strSource,char *strDestination){ int i; for(i=0;strSource[i]!='\0'; 阅读全文
posted @ 2020-12-15 19:43 bobo哥 阅读(140) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <iostream>using namespace std; class Test{private: int Width,Height;public: //以下是函数 void SetValue(int iWidth,int iHeight) { Width=iWidth 阅读全文
posted @ 2020-12-15 19:11 bobo哥 阅读(105) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <stdio.h>#include <string.h> int main(){ char str[20]; int length; length=strlen(strcpy(str,"Hello World!")); printf("字符串长度:%d\n",length 阅读全文
posted @ 2020-12-14 21:30 bobo哥 阅读(139) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <stdio.h>void sum_data(unsigned int num,int *data,int *sum){ unsigned int count; int sum_temp; sum_temp=0; for(count=0;count<num;count++ 阅读全文
posted @ 2020-12-14 21:21 bobo哥 阅读(379) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <stdio.h>#define N 5int main(){ int score[N]; //={89,67,80,85,79}; int i,j,max,min,temp; for(i=0;i<N;i++) { printf("请输入第 %d 学生的成绩:",i+1) 阅读全文
posted @ 2020-12-14 20:45 bobo哥 阅读(860) 评论(0) 推荐(0) 编辑
摘要:#include <iostream>using namespace std;class Test{private: static int x; //静态变量 int n;public: Test(){}; Test(int a,int b) { x=a; n=b; } static int fun 阅读全文
posted @ 2020-12-13 11:44 bobo哥 阅读(146) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <iostream>using namespace std;//shape类中有纯虚函数,所以shape类是抽象类,抽象类定义的对象//也是抽象的,只能用指针对象,不能用普通对象,更不能用普通对象实例化class shape{public: virtual double 阅读全文
posted @ 2020-12-13 10:59 bobo哥 阅读(174) 评论(0) 推荐(0) 编辑
摘要:源程序: /*//1、二维矩阵原样输出//2、转90度输出//3、每行最后增加一个元素,变成正方形矩阵输出//4、求矩阵中的最大值和最小值//5、求主对角线和副对角线之和*/#include <stdio.h>int main(){ int Numbers[4][3]={1,1,1, 2,4,8, 阅读全文
posted @ 2020-12-13 10:09 bobo哥 阅读(1628) 评论(0) 推荐(0) 编辑
摘要:#include <stdio.h>#include <string.h>int main(){ float score; int temp; char grade[5]; printf("please input the score;\n"); scanf_s("%f", &score); tem 阅读全文
posted @ 2020-12-10 22:50 bobo哥 阅读(2183) 评论(0) 推荐(0) 编辑
摘要:abstract class Geometr //定义抽象类,几何图形{ public abstract double getArea(); //抽象函数,得到底面积} class Pillar //柱子类 { Geometr bottom; //柱子的底面 double height; //柱子的 阅读全文
posted @ 2020-12-08 21:24 bobo哥 阅读(459) 评论(0) 推荐(0) 编辑
摘要:源程序: //*******************************//程序:冒泡排序//描述:用外层趟数和内层交换数完成//输入:用数组输入//输出:用显示器输出//其他://*******************************#include <iostream>#includ 阅读全文
posted @ 2020-12-08 20:40 bobo哥 阅读(1330) 评论(0) 推荐(0) 编辑