now im getting all zero's...
Printable View
now im getting all zero's...
Anytime you have an issue post the code.
It's the only way I can help you. Cause I don't know what you actually changed.
Code:#include<iostream>
#include<fstream>
using namespace std;
int main()
{
short number = 0;
short evenNumber = 0;
ofstream outfile;
ifstream infile;
outfile.open ("evennumList.txt",ios.app);
infile.open ("numberList.txt",ios.in);
if (infile.is_open()== false)
cout << "Error"<<endl;
else
while(infile >> number)
{
infile >> number;
if (num%2 == 0)
{
outfile << evenNumber << endl;
}
}
infile.close();
outfile.close();
return 0;
Need to change evenNumber to just number, since that is the value you are checking for even.
That is why it is always 0, because the value of evenNumber never changes.
oh yeah duh
thanks