
代码
w_zhao
这个作者很懒,什么都没留下…
展开
-
LeetCode算法
Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution.Example:Given nums = [2, 7, 11, ...原创 2018-03-09 15:38:26 · 168 阅读 · 0 评论 -
C++primer 习题第四章(1)
4.7编写代码实现一个数组赋值给另外一个数组,然后将这段代码改用vector实现。考虑如何将一个vector 赋值给另一个vector。int main(){ int a[3] = { 1,2,3 }; int b[3]; cout << "array :" << endl; for (int i = 0; i < 3; i++) { b[i] = a...原创 2018-03-16 22:03:05 · 291 阅读 · 0 评论 -
C++ primer 习题第四章(2)
4.26 编写程序从标准输入设备读入一个string类型的字符串。考虑如何编程实现从标准输入设备读入一个C风格字符串。int main(){ cout << "C++ style" << endl; string str; cin >> str; cout << str << endl; cout << &qu原创 2018-03-16 22:11:10 · 307 阅读 · 0 评论 -
C++primer第五章
5.18 编写程序定义一个vector对象,其每个元素都指向string类型的指针,读取该vector 对象,输出每个string内容及其相应的长度。int main(){ vector<string*> vec_str; string str; while (cin >> str){ string *st = new string(str); vec_st...原创 2018-03-29 20:17:49 · 165 阅读 · 0 评论 -
C++primer第六章《学习》
6.7 前面已经实现的统计元音的程序存在一个问题:不能统计大写的元音字母。编写程序统计大写小写的元音字母,也就是说,你的程序计算出来的aCnt,既包括’a’也包括’A’出现的次数,其他四个元音也一样。int main(){ ifstream infile; infile.open("test.txt"); char ch; int aCnt(0); while (!infile.eof...原创 2018-03-29 20:22:53 · 348 阅读 · 0 评论