摘要: if (!cin) { cin.clear(); while (cin.get() != '\n') continue; cout << "Bad input; input process terminated.\n"; break; } 阅读全文
posted @ 2018-09-28 23:19 ranwuer 阅读(594) 评论(0) 推荐(0) 编辑
摘要: // 输入一个包含多个double元素的数组,先打印结果,然后反转出头和尾元素之外的所有元素,最后再打印结果 #include using namespace std; int fill_array(double arr[], int size); void show_array(double arr[], int size); void reverse_array(double arr[],... 阅读全文
posted @ 2018-09-28 22:45 ranwuer 阅读(1830) 评论(0) 推荐(0) 编辑
摘要: #include using namespace std; long factorial(int value); int main() { int value; cout > value; cout << "factorial: " << factorial(value) << endl; return 0; } long factorial(int value) { if (v... 阅读全文
posted @ 2018-09-28 20:01 ranwuer 阅读(773) 评论(0) 推荐(0) 编辑
摘要: 操作方法: 输入两个数字,第一个数字是备选总数,第二个数字是选择总数,然后返回中将概率。 可以投注多次,结束的时候返回总的中将概率。 阅读全文
posted @ 2018-09-28 19:39 ranwuer 阅读(1112) 评论(0) 推荐(0) 编辑
摘要: #include using namespace std; struct box { char maker[40]; float height; float width; float length; float volume; }; void displayBox(const box b); void setVolume(box * b); int main() { box ... 阅读全文
posted @ 2018-09-28 14:34 ranwuer 阅读(356) 评论(0) 推荐(0) 编辑
摘要: #include using namespace std; void inputScores(double golfScores[], int size); void displayScores(double golfScores[], int size); void averageScores(double golfScores[], int size); int main() { ... 阅读全文
posted @ 2018-09-28 12:13 ranwuer 阅读(1076) 评论(0) 推荐(0) 编辑
摘要: #include using namespace std; double harmonicMean(double x, double y); int main() { double x, y; while (cin >> x >> y) { // 这一步是读取一行的两个数 if (0 == x || 0 == y) break; cout << harmonicMean(x, y... 阅读全文
posted @ 2018-09-27 23:14 ranwuer 阅读(1402) 评论(0) 推荐(0) 编辑
摘要: C++中流(stream)是一个对象,所以任何有流这种行为的对象也是流对象。 流主要分为三种类型: istream: 主要是从流中执行输入操作 ostream:主要是从流中执行输出操作 iostream:主要是从流中执行输入输出操作 每个流对象都关联一个流buffer,程序一般从buffer中读取数 阅读全文
posted @ 2018-08-28 18:14 ranwuer 阅读(5769) 评论(2) 推荐(1) 编辑
摘要: MQ(消息队列) 消息队列主要用于以下场景: 1. 上传图片,用户需要迅速反馈,把上传图片的后续操作交给consumer 2. A用户对B用户发消息 3. 日志记录,APP发生的任何警告错误日志都要被记录到日志数据库中 4. 浏览量统计,比如,一个item被用户点赞,评论,收藏了,那么需要重新计算此 阅读全文
posted @ 2018-06-03 20:51 ranwuer 阅读(144) 评论(0) 推荐(0) 编辑
摘要: 1. 熟悉你所掌握的编程语言。比如我用java,那么需要熟练掌握java的语言细节。 在遇到这样一个题,给定一个包含n个整数的数组,除了一个整数以外,其余的数都是成对出现,请找出这个数(复杂度O(n),不能使用额外存储空间)。比如[1,2,2],那么结果就是1。 我刚开始遇到这个题的时候完全没有想到 阅读全文
posted @ 2018-04-23 21:30 ranwuer 阅读(263) 评论(0) 推荐(0) 编辑