ProgramoBien

Ejemplo 1 (ifstream, comentarios)

Feb 1st, 2017
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 KB | None | 0 0
  1. #include <iostream>
  2. //#include <fstream>
  3.  
  4. using namespace std;
  5.  
  6. bool comment(string &s);
  7.  
  8. int main()
  9. {
  10.     string s;
  11.     //fstream ci;
  12.     //ci.open("text.txt");
  13.     while(getline(cin,s)){
  14.         if(!comment(s))
  15.             cout<<s<<endl;
  16.     }
  17.  
  18. }
  19.  
  20. bool comment(string &s){
  21.     bool com=false;
  22.     for(int i=0;i<s.size();i++){
  23.         if(s[i]!=' ')
  24.             if(s[i]=='#'){
  25.                 com=true;
  26.                 break;
  27.             }
  28.             else break;
  29.     }
  30.     return com;
  31. }
Add Comment
Please, Sign In to add comment