12 2019 档案

摘要:源程序: #include <iostream> using namespace std; static int glos = 100; void f() { int a = 1; static int fs = 1; cout << "在f中:a(自动)=" << a << " fs(静态)=" 阅读全文
posted @ 2019-12-23 08:41 bobo哥 阅读(142) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <iostream> using namespace std; class samp { public: void setij(int a, int b) { i = a; j = b; } ~samp() { cout << "析构..." << endl; } int 阅读全文
posted @ 2019-12-23 08:36 bobo哥 阅读(218) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <iostream> using namespace std; class A { private: int a, b; public: A(int k = 4, int j = 0) { a = k; b = j; } ~A(); void show(); }; voi 阅读全文
posted @ 2019-12-23 08:32 bobo哥 阅读(114) 评论(0) 推荐(0) 编辑
摘要:源程序:在vc++6.0中运行通过 // c0,c1,c2,c3,c4四个结点,在程序中和0,1,2,3,4来表示 // main.cpp // top_sort // // Created by duanqibo on 2019/12/20. // Copyright © 2019年 duanqi 阅读全文
posted @ 2019-12-20 15:23 bobo哥 阅读(188) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <iostream> using namespace std; class BaseClass { public: int v1, v2; BaseClass() { v1 = 1; v2 = 1; } int temp1() {} }; class DerivedCla 阅读全文
posted @ 2019-12-18 17:23 bobo哥 阅读(119) 评论(0) 推荐(0) 编辑
摘要:源程序: // // main.cpp // p154 // // Created by duanqibo on 2019/12/18. // Copyright © 2019年 duanqibo. All rights reserved. // #include <iostream> using 阅读全文
posted @ 2019-12-18 16:24 bobo哥 阅读(180) 评论(0) 推荐(0) 编辑
摘要:源程序: //"+"、"-"运算符重载 #include <iostream> using namespace std; class myComplex { private: double real, imag; public: myComplex(); myComplex(double x, do 阅读全文
posted @ 2019-12-18 14:56 bobo哥 阅读(201) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <stdio.h>#include <stdlib.h>#include <math.h>void prime(int m){ int k,i; k = (int) sqrt(m); for (i = 2; i <= k; i++) if (m % i == 0) bre 阅读全文
posted @ 2019-12-15 16:07 bobo哥 阅读(934) 评论(0) 推荐(0) 编辑
摘要:源程序: //把从键盘输入的文本按原样输出到名为file_a.txt的文件中,用字符@作为键盘输入//结束的标志#include <stdio.h>#include <stdlib.h>int main(){ FILE *fpout; char ch; if((fpout=fopen("e:\\fi 阅读全文
posted @ 2019-12-13 09:31 bobo哥 阅读(812) 评论(0) 推荐(0) 编辑
摘要:源程序: //把一个已经存在磁盘上的file_a.txt文本文件中的内容原样输出到终端上#include <stdio.h>#include <stdlib.h>int main(){ FILE *fpin; char ch; if((fpin=fopen("e:\\file_a.txt","r") 阅读全文
posted @ 2019-12-13 09:26 bobo哥 阅读(344) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <stdio.h>#include <stdlib.h>int main(){ int i; char s[100]; FILE *fp; if((fp=fopen("e:\\file.txt","w+"))==NULL) { printf("can't open thi 阅读全文
posted @ 2019-12-13 09:22 bobo哥 阅读(1686) 评论(1) 推荐(1) 编辑
摘要:源程序: #include <stdio.h>#include <stdlib.h>void filecopy(FILE *,FILE *);int main(){ FILE *fpin,*fpout; fpin=fopen("e:\\file_a.txt","r"); fpout=fopen("e 阅读全文
posted @ 2019-12-13 09:16 bobo哥 阅读(1753) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <iostream> #include <string> using namespace std; class myDate { private: int year, month, day; public: myDate(); void setDate(int y,int 阅读全文
posted @ 2019-12-11 13:41 bobo哥 阅读(197) 评论(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<<"Initializi 阅读全文
posted @ 2019-12-11 13:30 bobo哥 阅读(195) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <iostream> using namespace std; class Point { private: int x,y; public: Point(int=0,int=0); ~Point(); }; Point::Point(int a,int b):x(a), 阅读全文
posted @ 2019-12-11 13:25 bobo哥 阅读(145) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <iostream> #include <string> using namespace std; class myDate { private: int year, month, day; public: myDate(); void setDate(int y,int 阅读全文
posted @ 2019-12-11 13:20 bobo哥 阅读(184) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <iostream> #include <string> using namespace std; class myDate { private: int year, month, day; public: myDate(); void setDate(int y,int 阅读全文
posted @ 2019-12-11 13:15 bobo哥 阅读(212) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <iostream> #include <string> using namespace std; class myDate { private: int year, month, day; public: myDate(); void setDate(int y,int 阅读全文
posted @ 2019-12-11 11:45 bobo哥 阅读(161) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <iostream> #include <string> using namespace std; class myDate { private: int year, month, day; public: myDate(); myDate(int); //默认参数,从右 阅读全文
posted @ 2019-12-11 10:58 bobo哥 阅读(118) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <iostream> #include <string> using namespace std; class myDate { private: int year, month, day; public: myDate(); myDate(int); //默认参数,从右 阅读全文
posted @ 2019-12-11 10:53 bobo哥 阅读(161) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <iostream> #include <string> using namespace std; class myDate { private: int year, month, day; public: myDate(); myDate(int); //默认参数,从右 阅读全文
posted @ 2019-12-11 10:49 bobo哥 阅读(156) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <stdio.h> #include <stdlib.h> //#define MAXSIZE 100 /* 存储空间初始分配量 */ const int MAX_INT = 32767; const int vnum = 20; typedef struct gp { 阅读全文
posted @ 2019-12-10 11:25 bobo哥 阅读(318) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <stdio.h> #include <stdlib.h> #define MAXSIZE 9 /* 存储空间初始分配量 */ const int vnum = 20; typedef struct gp { char vexs[vnum]; /* 顶点表 */ int 阅读全文
posted @ 2019-12-09 13:22 bobo哥 阅读(1346) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <iostream> #include <string> using namespace std; class myDate { public: myDate(); myDate(int); myDate(int,int); myDate(int,int,int); vo 阅读全文
posted @ 2019-12-06 17:46 bobo哥 阅读(190) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <stdio.h>#define M 6int wnn1(int *,int,int);void wnn2(int *,int); void main(){ int i,x,n,t,s[M+1]={10,15,18,24,29,35}; printf("原数组为:\n") 阅读全文
posted @ 2019-12-06 09:38 bobo哥 阅读(1985) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <stdio.h> // 将src中奇数放入dst中,并返回奇数个数int getOdd(int *dst, const int *src, int srcLen){ int len = 0; for (int i = 0; i < srcLen; i++) if (sr 阅读全文
posted @ 2019-12-06 09:34 bobo哥 阅读(3701) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <stdio.h>void main(){ int i,n,str[10]={0};char ch; printf("请输入一串数字字符:"); while((ch=getchar())!='\n') { if(ch=='0') str[9]++; else if(ch> 阅读全文
posted @ 2019-12-06 09:33 bobo哥 阅读(2372) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <stdio.h>#include <stdlib.h>#define M 6#define N 5void getdata(int(*)[M]);void lineave(int[][M],float *);void outdata(int [N][M],float * 阅读全文
posted @ 2019-12-06 09:29 bobo哥 阅读(642) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <stdio.h> int mead(int *a,int *b){ int sum; sum=*a + *b; return sum;} int main(){ int x,y; int *p=&x,*q=&y; int s; printf("请输入两个整数:"); s 阅读全文
posted @ 2019-12-06 09:22 bobo哥 阅读(757) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <stdio.h> int mead(int *a,int *b){ int sum; sum=*a + *b; return sum;} int main(){ int x,y; int *p=&x,*q=&y; int s; printf("请输入两个整数:"); s 阅读全文
posted @ 2019-12-06 09:20 bobo哥 阅读(698) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <stdio.h> void order(int *x1,int *x2){ int t; if(*x1>*x2) { t=*x1; *x1=*x2; *x2=t; }} void main(){ int x,y; printf("请输入x,y的值:"); scanf(" 阅读全文
posted @ 2019-12-06 09:19 bobo哥 阅读(276) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <stdio.h>#include <stdlib.h> #define vnum 100 typedef char VerTexType; //定义链接队列的结点typedef struct LinkQueueNode{ int data1; struct LinkQu 阅读全文
posted @ 2019-12-05 10:16 bobo哥 阅读(1086) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <stdio.h>#include <stdlib.h> #define vnum 100 typedef char VerTexType;typedef struct arcnode{ int adjvex; //下一条边的顶点编号 struct arcnode *ne 阅读全文
posted @ 2019-12-04 16:02 bobo哥 阅读(617) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <stdio.h>#include <stdlib.h>#include <malloc.h>#include <string.h> #define MAX 100#define isLetter(a) ((((a)>='a')&&((a)<='z')) || (((a) 阅读全文
posted @ 2019-12-04 11:21 bobo哥 阅读(928) 评论(0) 推荐(0) 编辑
摘要:源程序: /*无向带权图的邻接矩阵表示法*/#include <stdio.h>#define vnum 20const int MAX_INT=0;typedef struct gp{ char vexs[vnum]; /*顶点信息*/ int arcs[vnum][vnum]; /*邻接矩阵*/ 阅读全文
posted @ 2019-12-04 10:39 bobo哥 阅读(3228) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <stdio.h>#include <stdlib.h> const int vnum=20; typedef struct gp{ char vexs[vnum]; int arcs[vnum][vnum]; int vexnum,arcnum;}Graph; //输入 阅读全文
posted @ 2019-12-04 10:05 bobo哥 阅读(1088) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <iostream> using namespace std; template <class T> void f(T a[], int n) { T t = 0; for (int i = 0; i < n / 2; i++) { t = a[i]; a[i] = a[ 阅读全文
posted @ 2019-12-03 16:12 bobo哥 阅读(243) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <iostream> using namespace std; class ctest { private: int x; public: ctest(const int x) { this->x = x; } int getx() const //const必须写在函数 阅读全文
posted @ 2019-12-03 14:33 bobo哥 阅读(767) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <iostream> #include <string> using namespace std; class CEmployee { private: string szName; int salary; public: void setName(string); st 阅读全文
posted @ 2019-12-03 11:15 bobo哥 阅读(115) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <iostream> using namespace std; class Box { public: double length; void setWidth(double wid); double getWidth(); private: double width; 阅读全文
posted @ 2019-12-03 11:01 bobo哥 阅读(142) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <iostream> #include <string> using namespace std; class myDate { public: myDate(); myDate(int, int, int); void setDate(int, int, int); v 阅读全文
posted @ 2019-12-03 10:36 bobo哥 阅读(209) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <iostream> #include <string> using namespace std; class myDate { public: myDate(); myDate(int, int, int); void setDate(int, int, int); v 阅读全文
posted @ 2019-12-03 10:26 bobo哥 阅读(169) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <iostream> #include <string> using namespace std; class myDate { public: myDate(); myDate(int, int, int); void setDate(int, int, int); v 阅读全文
posted @ 2019-12-03 10:21 bobo哥 阅读(160) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <iostream> #include <string> using namespace std; class myDate { public: myDate(); myDate(int, int, int); void setDate(int, int, int); v 阅读全文
posted @ 2019-12-03 10:04 bobo哥 阅读(136) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <iostream> using namespace std; class myDate { public: myDate(); myDate(int,int,int); void setDate(int,int,int); void setDate(myDate); m 阅读全文
posted @ 2019-12-03 09:36 bobo哥 阅读(149) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <iostream> #include <string> using namespace std; int main() { int n,i,length=0; cout << "输入几个字符串:"; cin >> n; string *p; string *A = ne 阅读全文
posted @ 2019-12-03 09:05 bobo哥 阅读(173) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <iostream> #include <string> using namespace std; int main() { int n,i; cout << "输入几个字符串:"; cin >> n; string *p; string *A = new string[ 阅读全文
posted @ 2019-12-03 08:46 bobo哥 阅读(129) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <iostream> #include <cstring> using namespace std; int main() { string s1 = "c++语言"; string s2 = "程序设计"; string s3 = s1 + s2; string s4; 阅读全文
posted @ 2019-12-02 19:45 bobo哥 阅读(124) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <iostream> #include <string> using namespace std; int main() { string str; if (str.empty()) cout << "str is NULL." << ",length=" << str. 阅读全文
posted @ 2019-12-02 19:17 bobo哥 阅读(120) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <iostream> #include <string> using namespace std; int main() { string s1, s2; s1 = "c++程序"; s2 = s1; string s3; cout << "s3=" << s3 << e 阅读全文
posted @ 2019-12-02 18:54 bobo哥 阅读(157) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <iostream> #define N 5 using namespace std; class Insert { private: int a[N]; public: Insert(int m[], int n) //构造函数初始化私有变量数组 { for (int 阅读全文
posted @ 2019-12-02 18:40 bobo哥 阅读(217) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <iostream> #define N 5 using namespace std; void insert_sort(int a[], int n) //直接插入排序 { int i, j, temp; for (i = 1; i < n; i++) { temp = 阅读全文
posted @ 2019-12-02 16:28 bobo哥 阅读(134) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <iostream> using namespace std; int bigger(int x, int y) { if (x > y) return x; else return y; } int bigger(float x, float y) { if (x > 阅读全文
posted @ 2019-12-02 15:30 bobo哥 阅读(160) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <iostream> using namespace std; int main() { int a1 = 3; const int a2 = a1; //数据a2是常量 int *a3 = &a1; //普通指针指向普通变量 const int *a4 = &a1; / 阅读全文
posted @ 2019-12-02 15:22 bobo哥 阅读(130) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <iostream> using namespace std; int oneX = 10; int oneY = 20; int &refValue(int &x) { return x; } int main() { refValue(oneX) = 30;//返回值 阅读全文
posted @ 2019-12-02 15:06 bobo哥 阅读(128) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <iostream> using namespace std; void SwapValue(int a, int b) { int tmp; tmp = a; a = b; b = tmp; cout << "在SwapValue()函数中:\t\ta=" << a < 阅读全文
posted @ 2019-12-02 11:38 bobo哥 阅读(252) 评论(0) 推荐(0) 编辑
摘要:源程序: 各种数据类型的转换 #include <iostream> using namespace std; int main() { const int cInt = 30; int oneInt = 50; int &ref = oneInt; const int &rc1 = cInt; c 阅读全文
posted @ 2019-12-02 11:29 bobo哥 阅读(107) 评论(0) 推荐(0) 编辑
摘要:源程序: using namespace std; int main() { int oneInt = 1; int &ref = oneInt; const int &refc = oneInt; //定义常引用 ref = 2; //修改ref也即修改了oneInt cout << "oneIn 阅读全文
posted @ 2019-12-02 11:19 bobo哥 阅读(114) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <iostream> using namespace std; void func(int a = 11, int b = 22, int c = 33) { cout << "a=" << a << ",b=" << b << ",c=" << c << endl; } 阅读全文
posted @ 2019-12-02 10:42 bobo哥 阅读(131) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <iostream> using namespace std; int main() { int a = 10; const int *p = &a; const int ca = 30; int *q; cout << "a的地址为:\t" << &a << "\ta的 阅读全文
posted @ 2019-12-02 10:35 bobo哥 阅读(138) 评论(0) 推荐(0) 编辑
摘要:源程序: #include <iostream> #include <string> using namespace std; int main() { int oneInt1, oneInt2; char strArray[20]; string str; double oneDouble; ch 阅读全文
posted @ 2019-12-02 09:14 bobo哥 阅读(185) 评论(0) 推荐(0) 编辑