摘要: 源程序: #include <iostream> using namespace std;class Point {public: Point(int x = 0, int y = 0) :x(x), y(y) { count++; } Point(Point&p) { x = p.x; y = p 阅读全文
posted @ 2020-02-06 21:09 bobo哥 阅读(205) 评论(0) 推荐(0)
摘要: 源程序: #include <iostream>#include <cmath>using namespace std; class Point{private: double x, y;public: Point() {}; Point(double a, double b) { x = a; y 阅读全文
posted @ 2020-02-06 20:48 bobo哥 阅读(179) 评论(0) 推荐(0)
摘要: 源程序: #include <iostream>using namespace std;class Location{public: int x, y; void init(int initx,int inity); int Getx(); int Gety();};void Location::i 阅读全文
posted @ 2020-02-06 20:23 bobo哥 阅读(210) 评论(0) 推荐(0)
摘要: 源程序: #include <iostream>using namespace std;class exa{ int a;public: exa(int b = 5) { a = b++; } void print() { a = a + 1; cout << a << " "; } void pr 阅读全文
posted @ 2020-02-06 20:16 bobo哥 阅读(134) 评论(0) 推荐(0)
摘要: 源程序: #include <iostream>using namespace std; class CTest{private: int n;public: CTest() { n = 1; } int GetValue() const { return n; } int GetValue() { 阅读全文
posted @ 2020-02-06 20:12 bobo哥 阅读(147) 评论(0) 推荐(0)
摘要: 源程序: #include <iostream>using namespace std; class base{private: int m;public: base() {}; base(int a) :m(a) {} int get() { return m; } void set(int a) 阅读全文
posted @ 2020-02-06 20:04 bobo哥 阅读(150) 评论(0) 推荐(0)
摘要: 源程序: #include <iostream>using namespace std; class A{ int a, b;public: A(int x = 0, int y = 0) { a = x; b = y; }};int main(){ A *p; p = new A(4,5); sy 阅读全文
posted @ 2020-02-06 19:57 bobo哥 阅读(143) 评论(0) 推荐(0)
摘要: 源程序: #include <iostream>using namespace std;class f{private: int x, y;public: void f1() { x = 10; y = 10; } void print() { cout << x << "," << y << en 阅读全文
posted @ 2020-02-06 19:52 bobo哥 阅读(142) 评论(0) 推荐(0)
摘要: 源程序: #include <iostream>using namespace std; class Test{private: static int num;public: Test(int); void show();};int Test::num = 5;Test::Test(int n){ 阅读全文
posted @ 2020-02-06 19:48 bobo哥 阅读(159) 评论(0) 推荐(0)
摘要: 源程序: #include <iostream>using namespace std; class Aton{public: int X, Y; int zx, zy; void init(int i, int j) { zx = i; zy = j; } Aton(int i, int j, i 阅读全文
posted @ 2020-02-06 19:39 bobo哥 阅读(128) 评论(0) 推荐(0)
摘要: 源程序: #include <iostream>using namespace std; class point{private: float x, y;public: void f1(float a, float b) { x = a; y = b; } point() { x = 0; y = 阅读全文
posted @ 2020-02-06 19:28 bobo哥 阅读(173) 评论(0) 推荐(0)
摘要: 源程序: #include <iostream>using namespace std;class point{private: float x;public: void f(float a) { x = a; } void f() { x = 0; } friend float max(point 阅读全文
posted @ 2020-02-06 19:20 bobo哥 阅读(128) 评论(0) 推荐(0)
摘要: 源程序: #include <iostream>#define PI 3.1415926using namespace std; class Cylinder{private: double r, h;public: Cylinder(double rr, double hh) { r = rr; 阅读全文
posted @ 2020-02-06 18:59 bobo哥 阅读(132) 评论(0) 推荐(0)
摘要: 源程序: #include <iostream>#include <math.h>using namespace std;class Point{private: float x, y;public: Point(float a, float b); float getX(); float getY 阅读全文
posted @ 2020-02-06 18:35 bobo哥 阅读(120) 评论(0) 推荐(0)
摘要: 源程序: #include <iostream>#include <cmath>using namespace std; class Point{private: double x, y;public: Point(double a, double b) { x = a; y = b; } doub 阅读全文
posted @ 2020-02-06 16:27 bobo哥 阅读(152) 评论(0) 推荐(0)
摘要: 源程序: #include <iostream>#include <string>using namespace std; class Course{private: string coursename; int credit; int xueshi; string type; string pro 阅读全文
posted @ 2020-02-06 15:48 bobo哥 阅读(194) 评论(0) 推荐(0)
摘要: 源程序: #include <iostream>using namespace std;class MyClassType1{private: int x, y;public: int getx() { return x; } int gety(); void setx(int x0) { x = 阅读全文
posted @ 2020-02-06 15:10 bobo哥 阅读(160) 评论(0) 推荐(0)
摘要: 源程序: #include <iostream>using namespace std;class Test{ int a, b; int getmin() { return (a < b) ? a : b; }public: int c; void setValue(int x1, int x2, 阅读全文
posted @ 2020-02-06 14:58 bobo哥 阅读(135) 评论(0) 推荐(0)
摘要: 源程序: #include <iostream>using namespace std; int main(){ int *p1; int **p2 = &p1; int b = 20; p1 = &b; cout << **p2 << endl; system("pause"); return 1 阅读全文
posted @ 2020-02-06 14:53 bobo哥 阅读(115) 评论(0) 推荐(0)
摘要: 源程序: #include <iostream>using namespace std;class A{public: int a, b;private: int c, d;public: int getc();};int A::getc(){ return c;}int main(){ A one 阅读全文
posted @ 2020-02-06 14:50 bobo哥 阅读(147) 评论(0) 推荐(0)
摘要: 源程序: #include <iostream>using namespace std; class Test{ int x, y;public: void fun(int i, int j) { x = i; y = j; } void show() { cout << "x=" << x; if 阅读全文
posted @ 2020-02-06 14:42 bobo哥 阅读(125) 评论(0) 推荐(0)
摘要: 源程序: #include <iostream>using namespace std;class Test{private: int x, y;public: Test(int i, int j) { x = i; y = j; } int getx() { return x; } int get 阅读全文
posted @ 2020-02-06 14:37 bobo哥 阅读(155) 评论(0) 推荐(0)
摘要: 源程序: #include <iostream>using namespace std;int bigger(int x, int y){ if (x > y) return x; else return y;} float bigger(float x, float y){ if (x > y) 阅读全文
posted @ 2020-02-06 14:25 bobo哥 阅读(124) 评论(0) 推荐(0)
摘要: 源程序: #include <iostream>#include <cmath>using namespace std; int f(int);int main(){ int i; for (i = 0; i < 3; i++) cout << f(i) << endl; system("pause 阅读全文
posted @ 2020-02-06 14:19 bobo哥 阅读(143) 评论(0) 推荐(0)
摘要: 源程序: #include <iostream>using namespace std;int main(){ int oneInt = 1; int &ref = oneInt; ref = 2; cout << "oneInt=" << oneInt << "," << "ref=" << re 阅读全文
posted @ 2020-02-06 14:15 bobo哥 阅读(145) 评论(0) 推荐(1)
摘要: 源程序: #include <iostream>using namespace std;class A{public: int fun(double); int fun(int);};int A::fun(double x){ return (int)x / 2;} int A::fun(int x 阅读全文
posted @ 2020-02-06 14:10 bobo哥 阅读(131) 评论(0) 推荐(0)
摘要: 源程序: #include <iostream>using namespace std; const double pi = 3.14159;int main(){ double r; cout << "输入r:"; cin >> r; double l = 2.0*pi*r; double s = 阅读全文
posted @ 2020-02-06 14:05 bobo哥 阅读(209) 评论(0) 推荐(0)
摘要: 源程序: #include <iostream>using namespace std;int main(){ const int x = 5, y = 6; const int *p = &x; p = const_cast<int *>(&y); cout << *p << endl; syst 阅读全文
posted @ 2020-02-06 14:00 bobo哥 阅读(124) 评论(0) 推荐(0)
摘要: 源程序: #include <iostream>using namespace std;void func(int a, int b, int c = 0){ cout << a << b << c << endl;}int main(){ func(5,9); system("pause"); r 阅读全文
posted @ 2020-02-06 13:57 bobo哥 阅读(135) 评论(0) 推荐(0)
摘要: 源程序:用面向对象方法又做一遍 #include <iostream>#define N 10using namespace std; template <typename T> class sum_array{private: T a[N];public: sum_array(T a1[]) { 阅读全文
posted @ 2020-02-06 10:07 bobo哥 阅读(167) 评论(0) 推荐(0)
摘要: 源程序: #include <iostream>#define N 10using namespace std; template <typename T> T sum_array(T a[], int n){ int i,size; T sum=0; cout << "您想求数组前几项的和,请输入 阅读全文
posted @ 2020-02-06 09:53 bobo哥 阅读(146) 评论(0) 推荐(0)
摘要: 源程序: 用三种排序:冒泡排序,直接插入排序,直接选择排序 #include <iostream>#define N 5using namespace std; template <typename T>//冒泡排序 /*void bubble_sort(T a[], int n){ int i, 阅读全文
posted @ 2020-02-06 09:02 bobo哥 阅读(133) 评论(0) 推荐(0)