Hello guys,
I am new in this forum and i hope im gonna get some fast help.
I have this problem where i should input numbers from a .doc file, and the program should output how many times the number of occurences of each number.
ie: the numbers in the .doc file are 2,3,6,8,9,2,1,1,3,1.
The program should read the numbers from the file and outputs the following:
Number 1 = 3
Number 2 = 1 ... and so on.
I started with the following but im getting stuck.
Any help please??
#include<iostream>
#include<fstream>
#include<iomanip>
using namespace std;
int main()
{
int array[10000];
ifstream numbers( "numbers.doc", ios::in);
if(!numbers)
{
cerr << endl << "File could not be opened" << endl;
system("pause");
exit(1);
}
for (i=0, i<10000, i++)
array = 0; //initializes array
for (i=0, i<50, i++)
{
if (i=1)
array[n] += array;
cout << array;
}
{
if (i=2)
array[n] += array;
cout << array;
}
///and so on.
I appreciate any suggestions and assistance,
Thank u