A word Decrambling game using srand() for descrambling these words: "Screen, Programming, Command, Definition." The game should be timed for 1 minute or 30 seconds using the library. Should allow for user input to be able to guess...
A word Decrambling game using srand() for descrambling these words: "Screen,
The game should be timed for 1 minute or 30 seconds using the <ctime> library.
Should allow for user input to be able to guess...

#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 words matches
if (Ch== userEnteredAfterSorting)
{
cout << checkPerWord<< endl;
}
}
words.close();
}
}
int main()
{
string string = "tac";
jumbledString(string);
return 0;
}
Step by step
Solved in 2 steps









