
C++
chinawqf
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
C++ primer plus 第14章习题
//第14章第1题 #ifndef WINE_H_ #define WINE_H_ #include #include #include //#include using std::cin; using std::cout; using std::endl; using std::string; template class Pair { private: T1 a; T2 b; publ原创 2016-05-23 17:08:58 · 1224 阅读 · 1 评论 -
指针做函数参数
程序1: void main() { char *p=NULL; myMalloc(p); //这里的p实际还是NULL,p的值没有改变,为什么? if(p) free(p); } void myMalloc(char *s) //我想在函数中分配内存,再返回 { s=(char *转载 2016-08-30 10:19:13 · 478 阅读 · 0 评论 -
c++ primer plus 第13章习题
//第13章 13.14 #ifndef STACK_H #define STACK_H #include using std::ostream; using std::istream; class baseDMA { private: char *label; int rating; public: baseDMA(const char *l = "null", int r = 0);原创 2016-05-20 14:59:32 · 718 阅读 · 0 评论 -
c++primer plus 第12章习题
//第12章第1题 #ifndef STACK_H #define STACK_H #define _CRT_SECURE_NO_WARNINGS class Cow { private: char name[20]; char *hobby; double weight; public: Cow(); Cow(const char *nm, const char * ho, doubl原创 2016-05-20 14:50:12 · 536 阅读 · 0 评论 -
c++primer plus 第六章习题
#include #include //第六章习题 using namespace std; int main() { char ch; cin.get(ch); while (ch != '@') { if (isalpha(ch)) { if (islower(ch)) cout << char(ch - 32); else if (isupper(ch))原创 2016-05-05 22:07:36 · 310 阅读 · 0 评论 -
C++primer plus 第七章习题(自己写的,欢迎指正)
第七章#include #include //第七章 using namespace std; double aver(const int *x, const int *y); int main() { int x, y; cout << "Please enter two figures:"; cin >> x >> y; double res = aver(&x, &y); co原创 2016-05-08 21:56:57 · 594 阅读 · 0 评论 -
C++ primerplus 第12章课本上例题
//第12章程序12.4,5,6. #ifndef STRING1_H #define STRING1_H #include using std::ostream; using std::istream; class String { private: char *str; int len; static int num_strings; static const int CINLIM原创 2016-05-18 12:32:00 · 476 阅读 · 0 评论 -
C++primer plus 第三 四章的习题(自己写的)
C++primer plus 课后习题答案(自己写的,希望对刚入门的童鞋有帮助!!!)原创 2016-04-29 22:11:43 · 601 阅读 · 0 评论 -
C++primer plus 第九章习题
#ifndef GOLF_H_ #define GOLF_H_ const int len = 40; struct golf { char fullname[len]; int handicap; }; void setgolf(golf &g, const char* name, int hc); int setgolf(golf &g); void h原创 2016-05-13 18:21:49 · 487 阅读 · 0 评论 -
C++ primer plus 第十章课后习题,原创答案。
//第十章第一题 #ifndef GOLF_H_ #define GOLF_H_ #include<string> #include<iostream>using std::string; class BankCount {private: string name; string account; unsigned long deposit; public:原创 2016-05-14 19:45:37 · 2543 阅读 · 0 评论 -
C++ primer plus 第11章习题
#ifndef VECTOR_H_ #define VECTOR_H_ #include //第11章 namespace VECTOR { class Vector { public: enum Mode {RECT,POL}; private: double x; double y; double mag; double ang; Mode mode;原创 2016-05-15 23:18:49 · 529 阅读 · 0 评论 -
C++primer plus 第五章习题!
#include #include //第四章1 using namespace std; int main() { int i, j,sum=0; cout << "请输入数据" << endl; cin >> i >> j; for (int k = i; k <=j; k++) sum += k; cout << "结果是" << sum << endl; system("p原创 2016-05-04 16:15:13 · 403 阅读 · 1 评论 -
c++primer plus 第八章习题答案(自己写的)
#include #include //第八章 using namespace std; void showstr(char *str, int n = 0); int main() { char *p = "I am a boy!"; showstr(p); for (int i = 0; i < 3; i++) { cout << i << ":"; showstr(p, i)原创 2016-05-11 23:25:16 · 2264 阅读 · 3 评论