hello

n is 10 numbers
10
50
25
75
2000
30
500
800
10
25
485
p.s var is the variable contains all above numbers


for example
if the user enters 25

how do i print out how many times number 25 was enterd
not in which index it is

thanks in advance

cout<< "enter an number" <<endl;

double c;
cin >> c;
for (int i=0; i<n; i++)
{
if (c==var[i])
	{
		cout << i ;

	cout << "found" << endl;
	}
}

Try making c and int not a double. == and != really don't work well with double and float types because those types approximate values.

thanks for your help

but this is not the problem

i want to know how to print out
how many times number was repeated like if the user inputs 25

a message appears with the number of 25 repeated (2 times)

Use an if statement and increment a counter

thanks

but i tried it but still not what i want

Well show us what your modified code and give a full description of how it is not working.

thanks guys for your help it worked

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.