words, and there respective hints on lines 10, 11 and 12, are editable, you can write any string you want.
Thanks for Using.
- Code: Select all
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <string>
using namespace std;
int randinit();
string jumble(string);
int main()
{
const string Word[3][2]={
{"Undefined","Something which is not defined"},
{"Explaination","Definition of undefinable"},
{"Hello","First word you say on your phone"}
};
const int rand_No = randinit();
unsigned short row = rand_No%3, column = rand_No%2;
string the_word=Word[row][0];
string the_hint=Word[row][1];
string jumbled;
string answer;
jumbled = jumble(the_word);
cout<<"\t\t\tWelcome To Jumble Word\n\n\n\n\n\n\n\n";
cout<<"Here's your word : \n"<<jumbled;
Jump:
cout<<"\t";
cin>>answer;
if(answer==the_word)
cout<<"\nCorrect!!!\n";
else
{
cout<<"\nWrong\n";
cout<<"Hint?('y'/'n')";
char conti;
cin>>conti;
if (conti == 'y')
{
cout<<the_hint;
goto Jump;
}
else
cout<<"\nThen get the hell outa here!!!!!\n";
}
cout<<"Written By CyberSpy aka TheFutureOfEminem\n";
system ("pause");
return 0;
}
int randinit()
{
srand(time(0));
return rand();
}
string jumble(string jumble)
{
int size=jumble.size();
for (int x=0; x<size; x++)
{
int index1 = rand() % size;
int index2 = rand() % size;
char temp = jumble[index1];
jumble[index1]=jumble[index2];
jumble[index2]=temp;
}
return jumble;
}
