Advertisement
Guest User

Untitled

a guest
Nov 21st, 2017
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. string text = "\0";
  8.  
  9.  
  10. cout << "Bitte Text eingeben (ggfs. mit Leerzeichen): ? ";
  11. getline(cin, text);
  12.  
  13. cout << "Der Text nach der Umwandlung: ";
  14. for (int i = 0; i < text.length(); i++) {
  15.  
  16.  
  17. if (text[i] >= '0' && text[i] <= '9')
  18. {
  19. text[i] = '.';
  20. cout << text[i];
  21.  
  22. }else if (text[i] == '!' || text[i] == '?') {}
  23.  
  24. else if (text[i] >= 'a' && text[i] <= 'z')
  25. {
  26.  
  27. cout << text[i] << text[i];
  28.  
  29. }else if (text[i] >= 'A' && text[i] <= 'Z')
  30. {
  31.  
  32.  
  33. cout << text[i] << text[i] << text[i];
  34. }else if (text[i] == ' ')
  35. {
  36. text[i] = '_';
  37. cout << text[i];
  38. }
  39.  
  40. else{
  41. cout << text[i];
  42. }
  43.  
  44.  
  45. }
  46.  
  47. cout << endl;
  48.  
  49. system ("pause");
  50. return 0;
  51.  
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement