/*
 USE IT HOWEVER YOU WANT :D
*/

#include <iostream>
#include <string>
#include <fstream>
#include <cstdlib>

using namespace std;


char name[100];
wchar_t words[100];
int choice;
int chmon;
int level;
int main (int argc, char *argv[])


{ //main

    string used("this game is cool");
    string in;

cout<<"Hello Welcome to the Code Game!"<<endl;    
cout<<"--------------x----------------"<<endl;
cout<<endl;
cout<<"Please enter yourname : ";
cin>>name;
cout<<endl;
cout<<"Welcome to the code game, ";
cout<<name<<endl;

cout<<"1. New game"<<endl;
cout<<"2. Level Select"<<endl;
cout<<"3. About"<<endl;
cout<<"--------------x----------------"<<endl;
cout<<endl;
cout<<"Please enter choice : "<<endl;
cin>>choice;

if (choice == 1)
{  
           cout<<endl;
           cout<<endl;
           cout<<"New game huh? Cool ! Let's start with some small codes!"<<endl;
           cout<<endl;
           cout<<endl;

           cout<<"1    2    3"<<endl;
           cout<<"ABC  DEF  GHI"<<endl;
           cout<<"4    5    6"<<endl;
           cout<<"JKL  MNO  PQR"<<endl;
           cout<<"7    8    9"<<endl;
           cout<<"STU  VXY  Z "<<endl;

           cout<<endl;
           cout<<endl;

           cout<<"I know there is no 'w' it is supposed to be like that."<<endl;
           cout<<endl;
           cout<<endl;
           cout<<"Try not to use Paper/Pen."<<endl;
           cout<<endl;
           cout<<endl;
           cout<<"Here is your first code : [7337] [3152] [37] [1554] "<<endl;
           cout<<endl;
           cout<<"The sentence is : ";
           getline(cin, in);
           getline(cin, in);
           cout<<endl;

           if (in == used)
           {
               cout<<"You're right! Congratulations!"<<endl;
               }

               else
               {
                   cout<<"You're wrong"<<endl;
                   }

               cout<<"Wanna try again? If yes Press '1' for Yes and '0' for no :"<<endl;


                                               cin>>chmon;
                                               if(chmon == 1)
                                               {
                                                        cout<<"Okay! Nice!"<<endl;

                                                        //Add game codes here! from text file! 


                                                        }                         

                                                        else 
                                                        {
                                                             cout<<"Okay then, Have a nice day!"<<endl;
                                                             system("start /MIN Soundtrack.mp3");
                                                             exit (EXIT_SUCCESS);
                                                             }                     
}

else if (choice == 2)
{//else if for real choice (2)
     cout<<"Please select Level from 1 - 25 !"<<endl;
     cout<<endl;
     cin>>level;

     } //else if for real choice (2)
else if(choice == 3)
{ //else if for real choice (3)
     cout <<"This game was made by HAYZAM "<<endl;
     }     //else if for real choice (3)
else 
{ //else for no real choice 
     cout << "Sorry this is not a real choice."<<endl;
     }    //else for no real choice 



system("PAUSE"); 
    return 0;
}   //main

Hey guys! This is the code that I've been working for the past couple of hours! What I need is that I want to read some text files and use them on the program, for example I want to give the user the code of the particular word.. not the word itself for this I need to output only some parts of a line in the text file, how will I do this? Thanks! Please check the text file that is attached..

Google "C++ text files" example

I know how to take text from a file, but I have almost 120 of them now! How will I automate the process..? Can show me an example using a code? I want to display 1 text at a time, that too just half of the line! Each time the user inputs the correct code for the word it should move on to the next.

I assume by text you mean a word.
Perhaps this can give you some ideas.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.