I have written a code for word descrambling game in C++. The code is working perfectly fine. But the code is not showing any output.
Can somebody help me with what to do? I mean just tell me what am I missing to show the output of the code.
#include <bits/stdc++.h>
using namespace std;
string sortString(string word)
{
transform(word.begin(), word.end(), word.begin(), ::toupper);
sort(word.begin(), word.end());
return word;
}
void jumbledString(string jumble)
{
string checkPerWord = "";
string userEnteredAfterSorting;
userEnteredAfterSorting = sortString(jumble);
ifstream words("words.txt");
if (words) {
while (getline(words, checkPerWord)) {
string Ch = sortString(checkPerWord);
if (Ch == userEnteredAfterSorting) {
cout << checkPerWord << endl;
}
}
words.close();
}
}
int main()
{
string string = "tac";
jumbledString(string);
return 0;
}