#include<iostream.h>
int main()
{
    int num,j,c=0,limit,i,k;
    int*freq=new int[];
    int*munam=new int[];
    cout<<"How many times u want to enter the numbers\n";
    cin>>k;
    cout<<"tell ur range in which u will enter\n";
    cin>>limit;
    for( i=0; i<k; i++) {
        cout<<"Enter number\t"<<i+1;
        cin>>munam[i];
        if(num>limit) {
            cout<<"invalid num";
            return 0;
        }
        for( j=0; j<limit; j++) {
            freq[j]=0;
        }
        ++freq[munam[i]];
    }
    cout<<"Which no u wanna check :P";
    cin>>num;
    cout<<"You entered "<<num<<freq[num]<<" times";
    delete[]munam;
    delete[]freq;
    return 0;
}

Dunno why this code is having issues...i want that the code asks the user how many numbers he/she wants to enter ....then tell the range in which the numbers are supposed to be entered then it should tell how many TIME a certain number say (4) was entered if 4 lies in the range...PLZ HELP

First, always put your code in CODE tags...(and try not to post things in languages other than english)

Well, with a quick glance, here are a few things that i can see:

1) I don't think you can use new[] without specifying any size. You'll probably want to do something like

// using your variable names
int *freq = new int[limit];
int *munam = new int[k];

2) You have to initialize the freq array (the thing you did with the second for loop (with variable j)) first and NOT inside the main for loop (having variable i)

Implement these changes and let us know more...(but next time you post, please use code-tags)...
Also, indent your code properly and don't use single letters and/or your name as variables.

#include<iostream.h>


int main()

{



int num,j,limit,i,k;





cout<<"How many times u want to enter the numbers\n";

cin>>k;

cout<<"tell ur range in which u will enter\n";

cin>>limit;

 


int*freq=new int[limit];
int*munam=new int[k];

 for( j=0;j<limit;j++)
 {
	 freq[j]=0;
 }

for( i=0;i<k;i++)
{

	cout<<"Enter number\t"<<i+1;
	
cin>>munam[i];
	

if(num>limit)
{
	cout<<"invalid num";
	return 0;
}


	
	++freq[munam[i]];

	


}






cout<<"Which no u wanna check :P";

cin>>num;

cout<<"You entered "<<num<<freq[num]<<" times";

delete[]munam;

delete[]freq;
return 0;

}

[/qoute]

I have posted the right code above...iam also gonaa make a few adjustments in it to make it more awesome...:D thank u :P

my pleasure...

on a side note, don't start putting everything under CODE tags...:P

ryt...actually iam new on this forum...so thats why :P :D

a more modified version

#include<iostream>

using namespace std;


int main()

{



int num,j,range,start,i,k;


cout<<"How Many Times You Want to Enter the Numbers\n";

cin>>k;

cout<<"\n\nEnter starting range of entries/numbers Sir ";

cin>>start;

cout<<"\nEnter Ending limit Sir\n";

cin>>range;

 
int*freq=new int[range+1];

int*munam=new int[k+1];

for( j=start;j<=range;j++)
{


	 freq[j]=0;
 
}

for( i=1;i<=k;i++)
{

	cout<<"Enter number  "<<i<<" ";
	
cin>>munam[i];
	

if((munam[i]>range)||(munam[i]<start))
{
	cout<<"\nInvalid Number(Out of Range)\n";

	i--;

	continue;
	
}


	
	++freq[munam[i]];

	


}


cout<<"\n\nWhich No You Want to Check\n";

cin>>num;

cout<<"\n\nYou entered This Number  "<<freq[num]<<" times\n";

delete[]munam;

delete[]freq;
return 0;

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