Compiler Preprocessing Program (removing annotator)

Source: Internet
Author: User

// beforebegin. CPP
// preprocessing source Program , remove comments from the file // and/* lllll */
# include
# include
# include
# include
# include
using namespace STD;

// Delete the comments in the string //
String & deletenote1 (string & SS ){
Size_t lookhere = 0;
Size_t foundhere;
Size_t secondhere;
While (foundhere = ss. Find ("//", lookhere ))! = String: NPOs ){
Secondhere = ss. Find ("/N", foundhere );
SS. Erase (foundhere, secondhere-foundhere );
Lookhere = foundhere;
}
Return SS;
}
// Delete/**/annotator from the string
String & deletenote2 (string & SS ){
Size_t lookhere = 0;
Size_t foundhere;
Size_t secondhere;
While (foundhere = ss. Find ("/*", lookhere ))! = String: NPOs ){
Secondhere = ss. Find ("*/", foundhere );
SS. Erase (foundhere, secondhere-foundhere + 2 );
Lookhere = foundhere;
}
Return SS;
}

String & beforebegin (string & SS ){
Return deletenote1 (deletenote2 (SS ));
}

int main () {
ifstream in ("wowbull. CPP ");
ostringstream OSS;
OSS // string S = OSS. STR ();
// istringstream ins (replaceall (S, "from", "to");
ofstream out ("www. CPP ");
// out out return 0;
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.