Hi, I have written a program in python, and am looking to translate it into c++ code, here is the program:
import random
# You've got to guess 4 numbers between 0 and 30, if you get it right the program will output "WINNER" and tell you the computer's numbers
x = random.randint(0,30)
y = random.randint(0,30)
z = random.randint(0,30)
t = random.randint(0,30)
randnum = [x, y, z, t]
print "Enter 4 numbers between 0 and 30:"
for l in range(1, 5):
prompt = str(l) + " -->"
choice = int(raw_input(prompt))
if choice in randnum:
print "WINNER"
break
# -----------
else:
print "LOSER"
print "The Computer's Numbers Were:"
print "---",x,"---", y,"---", z,"---", t,"---"
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.