I'm making a word descramble program for http://www.hackthissite.org/missions/prog/1/ . I think I have a lot of this code correct but I dont know how to read each indivdual character in the scrambled string and compare it to the letters in the unscrabled string from the word list.
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
int i, l;
string x, y;
do
{
fstream file;
file.open("text.txt",ios::in|ios::out|ios::nocreate);
getline(file, x[i]); //read a string
i++;
}while(file);
file.close;
do
{
fstream file;
file.open("scramble.txt",iso::in|ios::out|ios::nocreate);
getline(file, x[i]); //read a string
l++;
}while(file);
file.close;
while(i >= 0)
{
if (x.length() == y.length())
{
//compare the number each char occurs and print word if they are equal
}
i--;
}
return 0;
}