kuchick32 -3 Light Poster

I have an assignment where I'm taking a file from my computer and using the numbers to pull something out. I'm supposed to take numbers from a file and checking to see how many times the number is in the file. But i can't seem to figure it out. This is what I have so far

#include <fstream>
#include <iostream>
#include <cstdlib>

int main()
{
    using namespace std;
    ifstream fin;
    ofstream fout;

    fin.open("Numbers.txt");
    fout.open("Numbers_Results.txt");

if(fin.fail())
{

cout<<"Input file open failed!!";
exit(1);
}

if(fout.fail())
{

cout<<"Input file open failed!!";
exit(1);
}

int target;
cout<<"Enter the number to search for: ";
cin>> target;

int count_1, count_2;
count_1 = 0;
count_2 = 0;

int next;
while(fin>>next);
++count_1;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.