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.
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.