Advertisement
myname0

new str

Dec 22nd, 2014
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.36 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <fstream>
  4. using namespace std;
  5. int main()
  6. {
  7.     string str, s, g;
  8.     ifstream in ("input.txt");
  9.     /*char c;*/
  10.     cout << "Enter letter ";
  11.     cin >> g;
  12.     while (in.peek()!=EOF)
  13.     {
  14.         in >> str;
  15.         if (( str[0] == g[0]) && (str[str.length()] == g[0]))
  16.             s += str + " ";
  17.            
  18.     }
  19.     cout << s;
  20.     in.close();
  21.  
  22.     return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement