C++学习
文章平均质量分 56
人工智zz
努力成为优秀的码农
展开
-
C++ Primer 10.6
#include #include #include #include #include #include #include using namespace std;class TextQuery{public: typedef vector::size_type line_no; void read_file(ifstream &is){ store_file(is)原创 2014-11-19 18:09:52 · 391 阅读 · 0 评论 -
C++ 爬楼梯
假设你现在正在爬楼梯,楼梯有n级。每次你只能爬1级或者2级,那么你有多少种方法爬到楼梯的顶部?#include using namespace std;int fun(int n){ if(n==0) return 0; else if(n==1) return 1; else if(n==2)原创 2014-10-21 18:20:40 · 9593 阅读 · 0 评论 -
【C++ Primer备忘录】习题10.18
#include #include #include #include #include #include using namespace std;typedef vector vstring;int main(){map family;string fname,cname,index;do{cout>fname;vector chilren;map::iterator ret = family.原创 2014-11-04 14:06:34 · 269 阅读 · 0 评论 -
算术平方根解法
第一种方法,使用二分法。//二分法求平方根,首尾两端不断逼近 float Sqrt(float m){ const float eps = 1e-11; //eps用于控制结果的精度 if(m<0){ cerr<<"无法求根"<<endl; return -1; } float mid,low,up,last; low = 0,up = m; mid = (low +原创 2014-11-06 16:55:06 · 1752 阅读 · 0 评论 -
【C++Primer备忘录】 习题10.25
#include #include #include #include #include using namespace std;int main(){ vector book; set name; string str; cout<<"输入要读的书名:"; while(cin>>str && str != "Quit") book.push_back(str); c原创 2014-11-07 13:51:54 · 299 阅读 · 0 评论 -
计算机实际上是如何工作的
伯乐原文:http://www.simplecpu.com/Binary.htmlhttp://www.simplecpu.com/Binary.html二进制让我们马上进入数据的梦幻王国。五的符号是什么?5十的符号是什么?10等等,这不是符号“1和0”吗?是的,在我们的编码系统中,当我们要表示”十”的时候,我们会写1和0。这里没有单独表示十的符转载 2014-12-03 16:59:32 · 430 阅读 · 0 评论