//generating random numbers within range….
#include<stdlib.h> //for random() or randomize() functions…
#include<conio.h>
#include<iostream.h>
#include<iomanip.h>
#include<conio.h>
#include<iostream.h>
#include<iomanip.h>
/*..Main Function Start’s….*/
void main()
{
randomize();
int num,rndnum;
clrscr();
cout<<ENTER THE NUMBER WHICH YOU WANT TO RANDOMIZE::::<<endl;
cin>>num;
rndnum=random(num)+7; /*random(num) will generates the numbers within range 0 to num-1*/
for(int n=1;n<=rndnum;n++)
cout<<n<<” “<<endl;
getch();
void main()
{
randomize();
int num,rndnum;
clrscr();
cout<<ENTER THE NUMBER WHICH YOU WANT TO RANDOMIZE::::<<endl;
cin>>num;
rndnum=random(num)+7; /*random(num) will generates the numbers within range 0 to num-1*/
for(int n=1;n<=rndnum;n++)
cout<<n<<” “<<endl;
getch();
/*…Main Function End’s….*/
}
}
THE OUTPUT IS::::::::::::
No comments:
Post a Comment