- 博客(21)
- 问答 (1)
- 收藏
- 关注
原创 c++ primer 学习笔记-第十六章
习题16.2:#ifndef COMPARE_H#define COMPARE_H#include templateT compare(const T &v1, const T &v2){ std::cout << "类型模板参数" << std::endl; if (v1 < v2)return 1; if (v2 < v1)return -1; return 0;}
2015-09-24 12:49:21 413
原创 c++ primer 学习笔记-第十五章
习题15.3:#ifndef QUOTE_H#define QUOTE_H#include #include class Quote{public: //构造函数 Quote() = default; Quote(const std::string &book, const double &p) :bookNo(book), price(p){ } //返回ISBN编号
2015-09-17 19:31:33 410
原创 c++ primer 学习笔记-第十四章
习题14.2:Sales_data.h:#ifndef SALES_DATA_H#define SALES_DATA_H#include #include #include using std::string;using std::cin; using std::cout; using std::endl;using std::istream; using std::o
2015-09-15 12:15:31 414
原创 c++ primer 学习笔记-第十三章
习题13.5:#ifndef TEST_H#define TEST_H#include #include class HasPtr{public: HasPtr(const std::string &s = std::string()) :ps(new std::string(s)), i(0){ }; HasPtr(const HasPtr &cs) :ps(new std:
2015-09-06 18:44:18 487
原创 c++ primer 复习-函数
学到动态内存的时候,出现许多使用函数尤其是类的相关知识的应用,因练习量不足,知识出现遗忘,继续学习颇感吃力。因此决定在向下学习之前,先开始第一轮复习,将重要的知识系统梳理一遍,以便完成后续的学习内容。1.参数传递①参数传递的方法有2种:传值参数、传引用参数。a.传值参数: 对于整形此类,就是形参拷贝实参,对形参的改变不影响实参;对于指针形参,拷贝的是指针本身,
2015-08-22 14:25:47 492
原创 c++ primer 学习笔记-第十一章
习题11.3-4:#include #include #include #include #include #include using std::cin; using std::cout; using std::endl;using std::string;using std::istream; using std::ifstream;using std::map; usi
2015-08-20 10:27:02 383
原创 c++ primer 学习笔记-第十章
习题10.1:#include #include #include #include using std::cin; using std::cout; using std::endl; using std::flush;using std::vector; using std::string;using std::count;int main(){ vector ivec;
2015-08-16 10:13:10 403
原创 c++ primer 学习笔记-第九章
习题9.4:#include #include using std::cin; using std::cout; using std::endl;using std::vector;using Iter = vector::const_iterator;bool find(Iter beg, Iter end, int num){ while (beg != end) {
2015-08-11 08:58:42 473
原创 c++ primer 学习笔记-第八章
习题8.1:#include #include using std::cin; using std::cout; using std::endl;using std::istream;using std::string;istream &f(istream &is){ string s; is >> s; for (; !is.eof(); is >> s) cout
2015-08-10 09:28:48 316
原创 c++ primer 学习笔记-第七章
习题7.1:#include #include using std::cin; using std::cout;using std::endl; using std::string;struct Sales_data{ string bookIsbn; unsigned units_sold = 0; double price = 0.0; double reve
2015-08-06 14:45:22 470
原创 c++ primer 学习笔记-第六章
习题6.2:#include #include #include #include using std::cin; using std::cout;using std::endl;using std::string; using std::vector;using std::begin; using std::end;
2015-08-03 21:33:30 436
原创 c++ primer 学习笔记-第五章
习题5.5:#include #include #include #include #include using std::cin; using std::cout;using std::endl;using std::string; using std::vector;using std::begin; using std::end;
2015-08-02 14:04:22 317
原创 c++ primer 学习笔记-第四章
习题4.21:#include #include #include #include #include using std::cin; using std::cout;using std::endl;using std::string; using std::vector;using std::begin; using std::end;using std
2015-08-02 12:16:56 355
原创 c++ primer 学习笔记-第三章
习题3-4:#include #include using std::cin; using std::cout;using std::endl; using std::string;int main(){ string s1, s2; while (cin >> s1 >> s2) { if (s1 == s2) cout << "same length" << e
2015-07-29 15:36:28 311
原创 SICP笔记与习题-第一章
习题1.3:(define (sum2Greater a b c) (cond ((and (< a b) (< a c)) (+ b c)) ((and (< b a) (< b c)) (+ a c)) ((and (< c a) (< c b)) (+ a b))))(define (sum2Bigger a b c) (if (and (< a
2015-07-26 14:35:29 453
原创 c++ primer 学习笔记-第一章
1.习题1-10:#include int main(){ std::cout << "this program will display numbers from 10 to 0 inclusive:" << std::endl; int num = 10; while (num >= 0) { std::cout << num << " ";//githu
2015-07-25 18:11:10 324
原创 学习日记-MIT[计算机科学与编程导论]-7,8
列表以及可变性,字典,伪代码,对于代码运行效率的简介1.List具有可变性。若L1=[...],L2=L1,则当L2[4]=5时,L1[4]=5。2.Dict也具有可变性,然而无序。3.使用pseudo code 伪代码。4.效率、复杂度、复杂增长率 Efficiency-orders of growth(此处包含着这样一层含义:我们所关心的并不是某种算法在某一
2015-07-21 12:47:42 433
原创 学习日记-MIT[计算机科学与编程导论]-6
二分法,牛顿-拉夫逊方法,对于列表的简介1.二分法(续):在上一堂课中,程序存在bug,对于x在(0,1)的情形将无法在迭代的过程中求出平方根,因为范围的调整不适用。 此处修正方法:将语句high=x修改为high=max(x,1)即可。2. Newton-Raphson method 牛顿拉夫逊法: 对于sqrt(x)的求取,本质是对f
2015-07-21 12:46:17 731
原创 学习日记-MIT[计算机科学与编程导论]-5
浮点数和二分法(逐次近似)1.讲解了浮点数的性质,着重解释了浮点数并不精确的原因。2.给出了二分法的函数实现。 在实现的过程中学会使用断言assert,确保用户输入、函数的formal parameters满足要求。如果满足,则不执行断言,否则就会提示断言错误,并结束程序。函数的代码实现:def bisection(x,epsilon):
2015-07-21 12:44:17 662
空空如也
MFC,后制作的登录对话框先启动,但原先的对话框不能运行计时器
2015-05-16
TA创建的收藏夹 TA关注的收藏夹
TA关注的人