I have a problem with code I am writing. I am supposed to count the instances of each specific digit that the user inputs. I am supposed to output blank digit appears blank time(s). I figured out how to get the numbers to go to different indexes in the array but now I don't know how to count each specific digit. Here is my code so far...and if I am asking a dumb question please don't make fun of me I am new to this...:)
#include <iostream>
#include <iomanip>
using namespace std;
//Declare the array size and declare the array
const int ARRAY_SIZE = 101;
double myList[ARRAY_SIZE];
int main ()
{
//Display A message Describing the Program
cout << "This program reads numbers from 0 to 100." << endl;
cout << "It will tell the number of occurences of each number in the list." << endl;
cout << "When prompted, enter any amount of numbers from 0 to 100, in any order." << endl;
cout << "Numbers can be repeated. Once zero is entered the program stops reading and counts the numbers." << endl;
cout << endl;
//Allocate memory for input numbers.
int number; //input numbers.
//Prompt the user to enter the integers needed for the program to run.
cout << "Enter the integers between 0 and 100: " << endl;
cin >> number;
//Initialize the Array.
for (int i = 0; i < ARRAY_SIZE; i++)
myList[i] = 0;
//Mark each number to its correspoding element.
int placeholder = 0;
while (number != 0)
{
myList[placeholder] = number;
placeholder++;
cin >> number;
}
//Prints the Array.
for (int i = 0; i < ARRAY_SIZE; i++)
{
cout << myList[i] << " ";
}
return 0;
}