hello guys,

how can i print a random values and print random function?

could you please write the code

thank you

just make int's and use a cout to print them them to the screen

ok could you please see my code

srand(time(NULL));
    system("MODE CON: COLS=90 LINES=360");
    system("TITLE Press ^<ESC^> to exit");
    cout <<      "Press <ESC> to exit\n\n";
    int   milliseconds = 500;
    char  key=0, esc=27;
    while(key != esc)
    {
	
     int villain = rand();
     system("cls");
   
       char wall = 177, flute = 14, hero = 2,
        life_hero = 3,life_evil = 3,villain1=1, bomb = 15,
        fish = 21;
         keys();       
         cout <<"                   +------------------+                          "<<endl;
         cout <<"                   |                  |                          "<<endl;
         cout <<"                   |         "<<fish<<"        |                          "<<endl;            
         cout <<"                   |                  |                          "<<endl;
         cout <<"                   |                  |                          "<<endl;
         cout <<"  +----------------+--------   -------+---------------+     "<<endl;
         cout <<"  |                         "<<life_evil<<""<<life_evil<<""<<life_evil<<"                       |     "<<endl;
         cout <<"  |                         "<<villain<<" "<<villain<<"                       |     "<<endl;
         cout <<"  |                          "<<hero<<"                        |     "<<endl;
         cout <<"  |                         "<<life_hero<<""<<life_hero<<""<<life_hero<<"                       |     "<<endl;
         cout <<"  +----------------+--------   -----+-----------------+     "<<endl;
         cout <<"  |                |                |                 |     "<<endl;
         cout <<"  |                |                |                 |     "<<endl;
         cout <<"  |                                                   |     "<<endl;
         cout <<"  |                |                |                 |     "<<endl;
         cout <<"  |                |                |                 |     "<<endl;
         cout <<"  +----------------+----------------+-----------------+     "<<endl;

please compiler this code to test it

now can you see the 'vallian' varible?

every time i want the villaian to move right,middle,left randomly

please help

waiing for you

Random number mean that it changes value. The position is the same.
Did you wanted to change position or value?

Random number mean that it changes value. The position is the same.
Did you wanted to change position or value?

Not necessarily. It simply means you cannot predict the next value -- which in fact may be the same as the current value.

Not necessarily. It simply means you cannot predict the next value -- which in fact may be the same as the current value.

you missed my point :)
I mean all that changes is value and not position

commented: Oh. OK. +11
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.