i make this progrm . first i generate this of 100 number .
then user cheaked the user how many time number is repeated in this series.
but i want random series of 100 number .
please check it & how to create a random series in this program.
#include<iostream.h>
#include<conio.h>
void generateData(int num []);
void printArray(int num[]);
int searchArray(int num[],int y);
int main()
{
int num[100],y;
generateData(num );
printArray(num);
searchArray(num,y) ;
return -1;
}
void generateData(int num [100])
{
for(int count=0;count<100;count++)
{
num[count]=count;
cout<<num[count]<<" ";
}
getch();clrscr();
}
void printArray(int num[100])
{
int count=0;
for(int row=1;row<=10;row++)
{
for(int col=1;col<=row;col++)
{
for(;count<100 && count<10*row ;count++)
{
cout<<num[count]<<" ";
}
}cout<<"\n";
}
}
int searchArray(int num[100],int y)
{
cout<<"enter the value THAT u want fine taht how many it repeat that : ";
cin>>y;
cout<<endl;
int counter=0;
for(int count=0;count<100;count++)
{
if(y==num[count])
{
counter++;
}
}
if(counter>0)
{
cout<<endl<<endl<<"the enter no is :"<<counter<<" times in table";
}
else
{
return -1;
}
}