I use this code to do a count for the variable "counting" !
As seen in the code the First for-loop do this counting and put this to the "Mainfile" as it is written but without the // ofcourse before.
Below I have a Second For loop. As seen I am counting from:
1535 until (20 + 1).
If I put back the // before the First for loop before MainFile and try to use the Second ouput for MainFile nothing is written to the file.
So the problem is why does the First MainFile write to the file but not the other one ?
using namespace std;
int main ()
int Combinations = 0;
int counting = 0;
ifstream StockFile ("CCE.txt");
for (int Number = 1535; Number < 1555; Number++)
if ((Number >= 1535) && (Number <= 1555))
counting = (counting + 1);
//MainFile << counting << "\n";
for (int Number2 = 1535; Number2 < (20 + 1); Number2++)
if ((Number2 >= 1535) && (Number2 <= 1555))
MainFile << Number2 << "\n";