0

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;
	}
}

Edited by WolfPack: Added Code tags and corrected spelling mistakes

2
Contributors
2
Replies
4
Views
6 Years
Discussion Span
Last Post by HASHMI007
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.