Added the main code, binary and wordlists

This commit is contained in:
Sayantan Santra 2020-06-27 19:40:56 +05:30
parent b39aee309f
commit c376ed9bad
6 changed files with 172875 additions and 0 deletions

View file

@ -1,2 +1,25 @@
# Unscrambler
A simple tool to unscramble English words.
# Dependencies
`g++` or any other `C++` compiler.
# Installation
```
git clone https://github.com/SinTan1729/Unscrambler
cd folderify
g++ Unscrambler.cpp -o Unscrambler
```
Or, you can simply use the precompiled binary that's included.
# Usage
Just run the binary, and follow the simple instructions.
### _You might buy me a cup of coffee:_
**UPI (preferred) : sintan@ybl**
**PayPal : sayantan.santra689@gmail.com**

BIN
Unscrambler Executable file

Binary file not shown.

46
Unscrambler.cpp Normal file
View file

@ -0,0 +1,46 @@
#include <iostream>
#include <fstream>
#include <algorithm>
//Just as the name suggests, This app unscrambles any given word using the wordlists provided
using namespace std;
int main()
{
ifstream Dictionary("Wordlist (Space Separated).txt");
ifstream Compare("Wordlist (Sorted).txt");
string sDictionary;
getline(Dictionary,sDictionary);
string sCompare;
getline(Compare,sCompare);
Start:
string s;
string temp;
cout << "Please enter the jumbled text below \n>";
cin >> s;
transform(s.begin(),s.end(),s.begin(),::tolower);
sort(s.begin(),s.end());
s=" "+s+" ";
long long int pos=-1;
int count=0;
do
{
pos=sCompare.find(s,pos+1);
if (pos!=string::npos && count==0) {cout <<endl << "You might be looking for:" << endl;}
if (pos!=string::npos) {temp=sDictionary.substr(pos+1,s.length()-2); transform(temp.begin()+1,temp.end(),temp.begin()+1,::tolower); cout << count+1 << ". " << temp <<endl; count++;}
}
while (pos!=string::npos);
if (count!=0) {cout << "\nTotal " << count << " matches found!\n";}
else {cout << "\nNo matches found!\n";}
cout << "\nDo you want to start again? (Y/N)>";
cin >> s;
if ((s.compare("Y")==0) | (s.compare("y")==0)) {cout << "\n--------------------\n\n"; goto Start;}
else
{
cout << "\nThank you for using!";
Dictionary.close();
Compare.close();
return 0;
}
}

172804
Wordlist (Line by Line).txt Normal file

File diff suppressed because it is too large Load diff

1
Wordlist (Sorted).txt Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long