Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Python to C++

Name: Anonymous 2009-02-21 7:16

Was wondering if someone could convert this to C++ for me;

a = 1
desiredamount = 64

f = open('double.txt', 'w')
print a
while a < desiredamount:
    a = a * 2
    print a
    value = a
    s = str(value)
    f.write(s)

In case you don't know Python but are willing to give the conversion a shot anyway, Python is pretty self explanatory but two variables, a and desiredamount, while a is less than desiredamount, double it and print the output to "double.txt". I should end up with a log file (double.txt) counting from 1 to 64.
Any help would be greatly appreciated.

Name: Anonymous 2009-02-21 7:48

>>3
cannot convert `const char*' to `FILE*' for argument `1' to `int fprintf(FILE*, const char*, ...)'

"for(i=1;i<64;i*=2)fprintf("%d",i);"

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List