Turbo C++‎ > ‎

Random

OUTPUT Q

:WORKING ON IT:
#include <iostream.h>
#include<stdlib.h>
void main()

randomize();

char color[][10]={"red","blue","pink","black"};

int paint;
for(int i=0;i<=2;++i)
{ paint=random(2)+1;

cout<<color[paint]<<":";
}
}


int num=random( n )
:
 num => ( min=0 | max=n-1 ) 


Hence output among options given will be the one which has only "blue" and "red"


Comments