Accelerated C++<第三章>
文章平均质量分 75
Aclite
这个作者很懒,什么都没留下…
展开
-
Accelerated C++<3-6>
//如果学生没有参加任何考试,则平均成绩计算可能会出现除零的问题,除零在C++中并未定义,在这种情况下,我们要告知程序会出怎样的结果。HintLook in the code and see which variable could be used as the denominator in division. Test that value against z原创 2017-03-27 21:18:57 · 397 阅读 · 0 评论 -
Accelerated C++<3-5>
//编写一个程序用于同时跟踪n个学生的成绩。要求程序能够保持两个向量的同步:第一个应保存学生的姓名;第二个保存总成绩,而这个总成绩能够根据读到的输入来计算。应假定家庭作业成绩的个数是固定的。HintAs suggested, use two vectors. Define a maximum number of grades to request for each student.原创 2017-03-27 15:26:46 · 441 阅读 · 0 评论 -
Accelerated C++<3-4>
//编写一个程序用于报告它的输入中最长以及最短字符串的长度HintFor each word that is input, keep track of the shortest and longest words you’ve encountered.SolutionCreate two variables of type string::size_ty原创 2017-03-27 11:47:38 · 533 阅读 · 0 评论 -
Accelerated C++<3-3>
//编写一个程序用于计算在它的输入中每个不同的单词所出现的次数。#include#include#include#includeusing namespace std;int main(){ //请求读入单词coutvectorwords;string word; //将读到的单词放入容器中原创 2017-03-27 10:21:21 · 459 阅读 · 1 评论 -
Accelerated C++<3-2>
// 将一个整数集合分为个数相等的4部分,而且第一部分含有的整数值比其他各部分的都大,第二部分的值比第一部分的小比其他两部分都大,剩下的两部分则以此类推。按照上面的要求,编写一个程序来计算并且打印这4部分。#include#include#includeusing namespace std;int main(){vectorintegers;coutint原创 2017-03-21 19:24:06 · 290 阅读 · 0 评论