/* * A simple code to filter the C/C++ source code. * Copyright (c) 2007 freebsd13
*/ #include using namespace std; int main() { char ch,ch1= 0; while(cin.get(ch)) { if(ch == '/') { cin.get(ch); switch(ch) { case '/': do{ cin.get(ch); }while(ch!='\n'); cout<
用Windows Live Writer 的代码插件无一例外都失败了·看来支持还不是很好。
- /*
- * A simple code to filter the C/C++ source code.
- * Copyright (c) 2007 freebsd13 <freebsd13@163.com>
- */
- #include <iostream>
- using namespace std;
- int main()
- {
- char ch,ch1= 0;
- while(cin.get(ch))
- {
- if(ch == '/')
- {
- cin.get(ch);
- switch(ch)
- {
- case '/':
- do{
- cin.get(ch);
- }while(ch!='\n');
- cout<<ch;
- break;
- case '*':
- do{
- cin.get(ch);
- cin.get(ch1);
- cin.putback(ch1);
- }while(!(ch == '*'&&ch1 == '/'));
- cin.get(ch);//吃掉放回去的字符
- break;
- default:
- cout<<'/';
- cout<<ch;
- }
- }else
- cout<<ch;
- }
- return 0;
- }
用ChinaUnix 的毫无疑问OK 但是要是离线编写就比较不知所措了。
阅读(390) | 评论(0) | 转发(0) |