上一页 1 ··· 17 18 19 20 21 22 23 24 25 ··· 74 下一页
摘要: 例子 1、scanf VS. getchar #include <cstdio> #include <cstring> int main() { char s[20]; while (scanf("%s", s) == 1) { printf("echo: %s\n", s); } // 但是 sc 阅读全文
posted @ 2020-05-04 10:36 xkfx 阅读(184) 评论(0) 推荐(0)
摘要: 题 习题5-4 复合词(Compound Words,UVa 10391)。完整题目见参考[1] #include <iostream> #include <cstring> #include <string> #include <set> using namespace std; set<stri 阅读全文
posted @ 2020-05-01 22:49 xkfx 阅读(248) 评论(0) 推荐(0)
摘要: 题 例题5-8 Unix is 命令(Unix is,UVA 400)。完整题目见参考[1] #include <iostream> #include <string> #include <algorithm> using namespace std; const int maxcol = 60; 阅读全文
posted @ 2020-04-27 16:58 xkfx 阅读(193) 评论(0) 推荐(0)
摘要: 正文 点运算符 . 例如 item.isbn() 只用于类类型对象。左侧运算对象必须是一个类类型的对象。右侧必须是该类型对象的一个成员名。运算结果是右侧对象指定的成员。 箭头运算符号 -> 例如 (*it).empty(); 是先对it解引用,然后解引用的的结果再执行点运算符。 箭头运算符是对上述表 阅读全文
posted @ 2020-04-23 22:37 xkfx 阅读(143) 评论(0) 推荐(0)
摘要: 例子 书上的原始代码: #include <iostream> using namespace std; struct Point { int x, y; Point(int x = 0, int y = 0): x(x), y(y) { // x(x), y(y) 等价于 // this->x = 阅读全文
posted @ 2020-04-21 23:07 xkfx 阅读(208) 评论(0) 推荐(0)
摘要: 例子 #include <cstdlib> #include <ctime> #include <vector> #include <algorithm> #include <cassert> using namespace std; void fill_random_int(vector<int> 阅读全文
posted @ 2020-04-15 09:52 xkfx 阅读(148) 评论(0) 推荐(0)
摘要: 例子 #include <iostream> #include <queue> #include <vector> using namespace std; struct cmp { bool operator() (const int a, const int b) const { return 阅读全文
posted @ 2020-04-14 10:08 xkfx 阅读(151) 评论(0) 推荐(0)
摘要: 题 例题5-6 团队队列(Team Queue,UVA - 540)。完整题目见参考[1] #include <cstdio> #include <queue> #include <map> using namespace std; const int MAXT = 1000 + 10; int m 阅读全文
posted @ 2020-04-13 11:06 xkfx 阅读(200) 评论(0) 推荐(0)
摘要: 题 集合栈计算机,完整题目见参考[1] 书上的原始代码如下: #include <iostream> #include <vector> #include <map> #include <set> #include <string> #include <stack> #include <algori 阅读全文
posted @ 2020-04-12 10:00 xkfx 阅读(134) 评论(0) 推荐(0)
摘要: 题 完整题目见参考[1]。 #include <iostream> #include <cstdio> using namespace std; int main() { int T, n, num; // 数据组数,商品种数,种商品的数量 float price, sum; // 某种商品的价格, 阅读全文
posted @ 2020-04-11 10:00 xkfx 阅读(274) 评论(0) 推荐(0)
上一页 1 ··· 17 18 19 20 21 22 23 24 25 ··· 74 下一页