Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. #include <string>
  4.  
  5. using namespace std;
  6.  
  7. int main ()
  8. {
  9. string line;
  10.  
  11. cout << "Programmed by Kelsey Weissman" << endl << endl;
  12.  
  13. cout << "Enter a sentence: ";
  14. getline(cin, line);
  15. cout << endl << endl;
  16.  
  17. cout << "Your sentence is: " << endl << line << endl << endl
  18. << "The first letter of each word is:" << endl;
  19.  
  20. if (!isspace(line[0]))
  21. {cout << line[0];}
  22.  
  23. for (int i = 0; i < line.length(); i++)
  24. {
  25. if (isspace(line[i]) && !isspace(line[i+1]))
  26. {
  27. cout << line[i+1];
  28. }
  29. }
  30.  
  31. cout << endl << endl << "Your original sentence was:" << endl << line << endl << endl;
  32.  
  33. system("pause");
  34.  
  35. return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement