易读程序之美学(六)~(十)知识.pptx

易读程序之美学(六)~(十);第六章 让批注精确与简洁;批注应该要有高信息空间比;范例: // int 是 CategoryType // pair 中的第一个 float 是 score // 第二个 float 则是 weight typedef hash_mapint pairfloat, float ScoreMap; 为什么要花三行解释?;范例: // CategoryType - (score, weight) typedef hash_mapint pairfloat, float ScoreMap; 这样有没有比较好?;范例: //将数据插入串行,并会先检查它是否过大 它是谁,数据还是串行? //将数据插入串行,并会先检查资料是否过大 //如果数据过小,就将它插入串行中 ;范例: //根据是否已经爬过这个URL,给予不同的优先权 //给予不曾爬过的URL较高的优先权;范例: //传回这个档案的行数 Int CountLines(string filename){…} 问题是怎样才算一行? hello hello\n hello\n world hello\n\r cruel\n world\r ;范例: //计算档案中的换行位(\n)个数 Int CountLines(string filename){…} ;范例一: //从输入字符串 src 中移除 chars

文档评论(0)

1亿VIP精品文档

相关文档