iam facing thesame problem of run page not getting displayed.can i use srand function in
this program. and what is its use and syntax?

#include<iostream.h> 
#include<stdlib.h>
int randomno();
int main()
{     int i;   
cout<<"ten random numbers for the range 0 to 50"<<endl;    
for(i=0;i<10;i++)    {      randomno();     }   
} i
int randomno()
{    
      int j;    
      j = rand();      
     if (!(j >= 50&&j<=0))   
     cout<< j<<endl; 
     return 0;
}

1) Stop spamming this board with all those new threads about the same program. Just continue adding to the thread you already have.

2) Learn to use code tags

3) Learn to format your code better so that you and other people can read it easier. I also made a couple changes in randomno() to remove all the extraneous code that isn't needed.

#include<iostream> 
#include<stdlib.h>
#include <ctime>
using std::cout;
using std::endl;

int randomno();

int main()
{    
    int i;   
    srand( (unsigned int)time(0) ); // seed the random number generator
    cout<<"ten random numbers for the range 0 to 50"<<endl;    
    for(i=0;i<10;i++)    
   {      
       cout << randomno() << "\n";    
   }   
}

int randomno()
{    
      return rand() % 50;
}
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.