Advertisement
Guest User

Untitled

a guest
Oct 21st, 2012
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.71 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. #include <string>
  4. #include <vector>
  5. #include <algorithm>
  6. #include <fstream>
  7.  
  8. using std::string;
  9.  
  10. int main()
  11. {
  12.     std::ifstream inFile ("C:\\reddit\\infl.txt");
  13.     string input;
  14.         std::cin >> input;
  15.             std::transform(input.begin(), input.end(), input.begin(), ::tolower);
  16.             sort(input.begin(), input.end());
  17.  
  18.     string word;
  19.  
  20.     if (inFile.is_open()){
  21.         while (!inFile.eof()){
  22.  
  23.             string temp;
  24.             inFile >> word;
  25.                 std::transform(word.begin(), word.end(), word.begin(), ::tolower);
  26.                 sort(word.begin(), word.end());
  27.  
  28.             if (word == input){
  29.                 std::cout << "Decoded word: " <<temp << std::endl;
  30.                 break;
  31.             }
  32.         }
  33.     }
  34.  
  35.     std::system("PAUSE");
  36.     return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement