searching for int's in an array and keeping count

this is my assignment, and below is what i've done so far. Any help is appreciated.

You are to write a program which will ask for the user to input 15 numbers. Your program then should find out which one shows up most often. In case of a tie, keep the first one typed.

At the end display the number and how many times it shows up.

#include<iostream>
#include<iomanip>

using namespace std;

int main()
{
const int quant=15;
double num[quant];
cout<<"Enter 15 numeric values: "<<endl;
for(int x=0; x<15; x++)
{
cout<<"Number "<<x+1<<": ";
cin>>num[x];
cout<<endl;
}
system("pause");
return 0;
}


Okay. You've asked the user for the 15 numbers.
Now you need to count how many times each number occurs.

PLEASE USE CODE TAGS (the <> formatting button) when posting code.
I understand that I need to count how many times each number occurs, what I don't know is how to identify the numbers being input...should i do something like...

<
int count=0;

for(x=0; x<15; x++)
{
for(y=0; y<15; y++)
{
if(num[x]=num[y])
{
count++;
}
}}
>










The code tags look like this WITHOUT THE 7's:

[7code]
(copy paste your code here)
[7/code]

When posting, if you look to the right you will see the word Format. Beneath that, you see an icon thats look like <>. Click that, and the put your code in between the two things that come up.

Hope that makes it clear.
 
cout<<"it should look like this:P";
Last edited on
Topic archived. No new replies allowed.