Advertisement
PuffySheep

thing

Nov 20th, 2014
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.89 KB | None | 0 0
  1.    
  2.  
  3.     #include <iostream>
  4.     #include <cctype>
  5.      
  6.     using namespace std;
  7.      
  8.     int main(int argc, char* argv[])
  9.     {
  10.       char buffer[100];
  11.      
  12.       // Get thhe string from the user.
  13.       cout << "Please enter a string: ";
  14.       cin >> buffer;
  15.      
  16.       // Iterate over the array.
  17.       for(int c = 0; c < 100; ++c) {
  18.         // Change the character to uppercase.
  19.         buffer[c] = toupper(buffer[c]);
  20.        
  21.         // Switch certain letters with numbers. l33t!
  22.         switch(buffer[c]) {
  23.         case 'A':
  24.           buffer[c] = '4';
  25.           break;
  26.          
  27.         case 'O':
  28.           buffer[c] = '0';
  29.           break;
  30.          
  31.         case 'I':
  32.           buffer[c] = '1';
  33.           break;
  34.         }
  35.       }
  36.      
  37.       // Print it out!
  38.       cout << "Cool, here is your string: " << buffer << "!!!!!" << endl;
  39.      
  40.       return 0;
  41.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement