Share Pastebin
Guest
Public paste!

Untitled

By: a guest | Mar 21st, 2010 | Syntax: None | Size: 0.93 KB | Hits: 62 | Expires: Never
Copy text to clipboard
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.         string tekst;
  9.         while(!getline(cin, tekst).eof())
  10.         {
  11.                 for(int i = 0 ; i  < tekst.length() ; i++)
  12.                 {
  13.                         if(isspace(tekst[i]))
  14.                         {
  15.                                 tekst[i] = tekst[i];
  16.                         }
  17.                         else if(tekst[i] == toupper(tekst[i]) && tekst[i] != 'X' && tekst[i] != 'Y' && tekst[i] != 'Z')
  18.                         {
  19.                                 tekst[i] = (tekst[i])+3;
  20.                         }
  21.                         else if(tekst[i] == 'X')
  22.                         {
  23.                                 tekst[i] = 'A';
  24.                         }
  25.                         else if(tekst[i] == 'Y')
  26.                         {
  27.                                 tekst[i] = 'B';
  28.                         }
  29.                         else if(tekst[i] == 'Z')
  30.                         {
  31.                                 tekst[i] = 'C';
  32.                         }
  33.                         while(tekst[i] != toupper(tekst[i]))
  34.                         {
  35.                                 if(tekst[i] == 'x')
  36.                                 {              
  37.                                         tekst[i] = 'A';
  38.                                 }
  39.                                 else if(tekst[i] == 'y')
  40.                                 {
  41.                                         tekst[i] = 'B';
  42.                                 }
  43.                                 else if(tekst[i] == 'z')
  44.                                 {
  45.                                         tekst[i] = 'C';
  46.                                 }
  47.                                 else
  48.                                 {
  49.                                         tekst[i] = toupper(tekst[i]);
  50.                                         tekst[i] = (tekst[i])+3;
  51.                                 }
  52.                         }
  53.                 }
  54.         cout << tekst << endl;
  55.         }
  56. }