
C++
文章平均质量分 73
Low丶Coder
这个作者很懒,什么都没留下…
展开
-
第二次上机作业letterCounting&lettercoutingWithFile&&EOJ 2844
1. letterCounting.cpp Write a function that countsthe number of occurrences of a pair of letters in a string. Then write a program thatreads a pair and a string to test the function. Blank原创 2017-05-22 16:28:58 · 451 阅读 · 0 评论 -
第三次上机作业EraseComments&&EOJ2948 map的使用
1. EraseComments.cpp Strip comments out of a C++ program. Read from a file, and write to another file. Beware of // /* */ within strings. 作业1大意是删除cpp源代码中所有带注释的部分,比如//的单行注释,/*xxx*/的多行注释原创 2017-05-30 16:16:28 · 358 阅读 · 0 评论 -
怎样删除C++代码中的注释——有限状态机思想的使用
K&R习题1-23中,要求“编写一个程序,删除C语言程序中所有的注释语句。要正确处理带引号的字符串与字符常量。在C语言中,注释不允许嵌套”。如果不考虑字符常量和字符串常量,问题确实很简单。只需要去掉//和/* */的注释。考虑到字符常量'\''和字符串常量"he\"/*hehe*/",还有类似/_stdio.h>的头文件路径符号以及表达式5/3中的除号/,以及情况就比较复杂了。转载 2017-05-30 17:45:26 · 799 阅读 · 0 评论 -
第四次上机作业SortUsingStackOnly
1. SortUsingStackOnly.cppWrite a function StackSort to sort a stack in ascending order.The following are the only functions that should beused to write this function: push | pop | top | empty.原创 2017-05-30 19:12:30 · 316 阅读 · 0 评论 -
第五次上机作业KeywordsCounting
Define a function that, given an istream& and a const vector&, produces a map> holding each string (keyword) and the numbers of the line on which the string appears. The line number of the first li原创 2017-06-06 17:07:32 · 825 阅读 · 0 评论 -
第六次上机作业Define a concrete class intset&&EOJ2853
1. intset.h + intset.cpp Implementing class IntSet. Define, implement, and test a set of integers – class IntSet. Provide union, intersection, difference and symmetric difference operati原创 2017-06-06 20:20:29 · 1005 阅读 · 0 评论 -
fstream详解
库包含了三个基本的类:ifstream, ofstream和fstream。这三个类分别代表一个输入文件,一个输出文件,以及一个输入输出文件。Ifstream类支持>>操作 符,ofstream类支持>和对象都能够把一个文件名当成构造函数的变量,并能够自动的打开文件,如: std::ofstream dictionary("myfile.txt"); 类的析构函数自动地添加清除文件内容并关闭文件,转载 2017-05-22 18:28:15 · 4165 阅读 · 0 评论