For some reason, when I do an output.put, it is not doing anything.
#include "stdafx.h"
#include <fstream>
#include <Windows.h>
using namespace std;
void main()
{
fstream input, output;
int in1=0, in2=0, x=0, k=0, l=0, max=0;
input.open("input.txt", ios::in);
output.open("output.txt", ios::out);
while(input.good())
{
input>>in1;
input>>in2;
for(x=in1; x<in2; x++)
{
k=x;
l=0;
while(k!=1)
{
if(k%2==0)k=k/2;
if(k%2==1)k=3*k+1;
l++;
}
if(l>max)max=l;
}
output.put('a');
output.put((in1-(in1%10))/10-48);
output.put((in1%10)-48);
output.put(32);
output.put((in2-(in2%10))/10-48);
output.put((in2%10)-48);
output.put(32);
output.put((max-(max%10))/10-48);
output.put((max%10)-48);
output.put(10);
}
Sleep(1000);
}
The output.put('a') was for debugging purposes, and even that is not doing anything. What's going on?