| helpplease911 (14) | |
|
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; } | |
|
|
|
| AbstractionAnon (517) | |
|
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. | |
|
|
|
| helpplease911 (14) | |
|
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++; } }} > | |
|
|
|
| INeedAHero (31) | |
|
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. | |
|
|
|
| supperpiccle (68) | |||
| |||
|
Last edited on
|
|||