• Log in or sign up for an account here: https://www.sythe.org/login

Urgent, please read

diabl0

Apprentice

Banned
Joined
Jul 25, 2008
Sythe Gold
0
Messages
902
Okay, I am in class, I need help with my code. The code is a Word jumble.

Okay what I have is

Code:
// Tyler sinks
// Programming 1
// Barry Fawthrop
// January 29, 2011

// This is a word jumble
// You are given 5 words scrambled up!

#include "stdafx.h"
#include <iostream>
#include <ctime>
#include <cstdlib>
#include <string>

using namespace std;

// Words and their hints!
int _tmain(int argc, _TCHAR* argv[])
{
const int SIZE = 25; // the words and the arry they are in
string WORD[SIZE] = {"word" , "nice" , "walk" , "open" , "door", 
"carry" , "blue" , "green" , "black" ,
"string" , "yellow" , "pink" , "gray" ,
"duck" , "bick" , "candy" ,"truck" , 
"yawn" , "lawn" , "hunt" , "fish" , 
"soda" , "drink" , "rink" , "snowboard"};
int counter;

srand(time(0));
// The counter so no more than 5
for (counter = 0; counter < 5; counter++){
int select = (rand() % SIZE);
string randWord =WORD[select];
string jumble = randWord;
int length = jumble.size();
// Randomizing!
for (int i = 0; i < length; ++i)
{
int index1 = (rand() % length);
int index2 = (rand() % length);
char temp = jumble[index1];
jumble[index1] = jumble[index2];
jumble[index2] = temp ;
}

int wordLength = WORD[select].size();
if (wordLength > 7)
cout << jumble << "\n";
else
cout << jumble << "\n";


}

return 0;
}

What I need to do from this code is make it to where you can guess what the words are, but you only have 4 chances to guess..
 
Runescape Gamblingrunescape gambling
Back
Top