Accelerated C++<第四章>
文章平均质量分 73
Aclite
这个作者很懒,什么都没留下…
展开
-
Accelerated C++<4-1>
//We noted in §4.2.3/65 that it is essential that the argument types in a call to max match exactly. Will the following code work? If there is a problem, how would you fix it?int maxlen;原创 2017-03-27 21:36:49 · 345 阅读 · 0 评论 -
Accelerated C++<4-2>
//Write a program to calculate the squares of int values up to 100. The program should write two columns: The first lists the value; the second contains the square of that value. Use setw to manag原创 2017-03-27 21:49:30 · 349 阅读 · 0 评论 -
Accelerated C++<4-3>
//如果重写上题的程序,让它计算从1到999的整数的平方。但是,我们忘记了更改setw的参数的值。会出现什么问题呢?重写这个程序,让它具有更好的适应性,再次修改你的求平方程序,用它来求double类型而不是int类型的值的平方。使用控制器控制输出,让数值按列排列起来。HintDetermine the length of the longest base原创 2017-04-10 23:16:21 · 395 阅读 · 0 评论 -
Accelerated C++<4-4>
//现在,再次修改你的求平方程序,用它来求double类型而不是int类型的值的平方。使用控制器控制输出,让数值按列排列起来。HintAllow for fractional values, and change how you determine the number of digits in the highest base and square.原创 2017-04-10 23:31:05 · 385 阅读 · 0 评论 -
Accelerated C++<4-5>
//编写一个函数以从输入流读单词,将读到的单词存储在一个向量中。利用这个函数编写一个程序以计算输入的单词的数目以及每一个单词所出现的次数。HintReview the implementation of read_hw in §4.1.3. Then, learn how to use separate compilation with your par原创 2017-04-10 23:43:16 · 410 阅读 · 0 评论 -
Accelerated C++<4-6>
//重新写Student_info结构并使用重写后的结构来直接计算成绩,要求在程序中仅存储总成绩。#include #include #include #include #include #include #ifdef _MSC_VER#include "../minmax.h"#elseusing std::max;#endif原创 2017-04-10 23:50:59 · 519 阅读 · 0 评论 -
Accelerated C++<4-7>
//编写一个程序计算存储在一个vector类型的向量中的数据的平均值。#include #include #include using namespace std;int main() { vector nums; double num; while (cin >> num) nums.push_back(nu原创 2017-04-10 23:58:12 · 700 阅读 · 0 评论