NUMBERS GAME | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 8

NUMBERS GAME

Check out this simple game. https://code.sololearn.com/cSTN2C47WNWz/?ref=app

2nd Aug 2017, 5:59 AM
Lakshay
Lakshay - avatar
5 Answers
+ 11
Using Roman numerals in switch case evaluation of integers is invalid. Use srand() and rand() instead of randomize() and random(). Include <cstdlib> (<stdlib.h> works nonetheless) and <ctime> for time(). Can you please indent your code ffs? :D
2nd Aug 2017, 6:38 AM
Hatsy Rei
Hatsy Rei - avatar
+ 9
@Corey, better, but remove <random.h>, and strings don't work with switch structures.
2nd Aug 2017, 6:51 AM
Hatsy Rei
Hatsy Rei - avatar
+ 7
follow the error messages! use them to guide you 😀
2nd Aug 2017, 6:14 AM
jay
jay - avatar
+ 4
Problem is solved . Now the program works well by using srand() and rand() and using integers in switch. Thank You !
2nd Aug 2017, 9:00 AM
Lakshay
Lakshay - avatar
2nd Aug 2017, 6:43 AM
Corey
Corey - avatar