I have to create a game, in which the computer chooses randomly a word out of 5 and randomizes its characters, so that the user has to guess the word. He can also get a hint of the computer. I have started the code, but dont know how to continue:

#include <iostream>
#include<ctime>
#include <string>
#include <iostream>
#include <ctype.h>
#include <cstring>
#include <locale>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
using namespace std;

int main()
{

    char aword[6] = {'h','o','u','s','e','\0'};
    char bword[11] = {'u','n','i','v','e','r','s','i','t','y','\0'};
    char cword[9] = {'c','o','m','p','u','t','e','r','\0'};
    char dword[5] = {'t','e','x','t','\0'};
    char eword[8] = {'p','i','c','t','u','r','e','\0'};
    char words[100];

    strcat(words, aword);
    strcat(words, bword);
    strcat(words, cword);
    strcat(words, dword);
    strcat(words, eword);

Edited 4 Years Ago by deceptikon: Fixed code tags

Hint

#include <iostream>
#include<ctime>
#include <string>
#include <iostream>
#include <ctype.h>
#include <cstring>
#include <locale>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
using namespace std;

int main()
{

    char aword[] = "House";
    char bword[] = "university";
    char cword[] = "computer";
    char dword[] = "text";
    char eword[] = "picture"
    char words[100] = {0};

    strcat(words, aword);
    strcat(words, bword);
    strcat(words, cword);
    strcat(words, dword);
    strcat(words, eword);

    srand((unsigned int)time(0)); // seed random number generator
    int wNum = rand() % 5; // get random word

Edited 4 Years Ago by Ancient Dragon: x

This article has been dead for over six months. Start a new discussion instead.