You will write a program that will scan in and store in an array a specified num
ID: 3672768 • Letter: Y
Question
You will write a program that will scan in and store in an array a specified number of integers ranging between 1 – 10. You can assume that the user will not enter a number less than 1 nor greater than 10. Your program will then count the number of occurrences of each number, store the count in an array and print the number of occurrences of each number.
Lastly, you will create an input.txt file that has first the number of integers that will be entered followed by the appropriate number of integers between 1 and 10.
You are to follow normal formatting requirements:
Provide a header
No lines longer than 80 characters
Proper and consistent indention
Appropriately comment your code
Use meaningful variable names
Sample output:
csdhcp153:Array yfeaste$ ./array <num.txt
In my list of 50, the number 1 occurred 4 times.
In my list of 50, the number 2 occurred 4 times.
In my list of 50, the number 3 occurred 5 times.
In my list of 50, the number 4 occurred 3 times.
In my list of 50, the number 5 occurred 4 times.
In my list of 50, the number 6 occurred 5 times.
In my list of 50, the number 7 occurred 3 times.
In my list of 50, the number 8 occurred 7 times.
In my list of 50, the number 9 occurred 7 times.
In my list of 50, the number 10 occurred 8 times.
in C++ only
using headers
#include <stdio.h>
#include <math.h>
Explanation / Answer
#include #include using namespace std; const int ARRAY_SIZE = 50; int myList[ARRAY_SIZE]; int inputCount=0; int main () { int number=0; coutRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.