0

I want to cin a random character, I tried adding stdlib.h library and used rand(), but it keeps giving me this error

error : the system cannot find the file specified. #include <iostream> #include <stdlib.h> using namespace std; int main() { for (int i = 1; i < 20 ; i ++){ cout << rand() % 6 + 1; if (i % 5 == 0) cout << endl; } system ("pause") ; }

26th Nov 2019, 6:27 PM
Zohal
Zohal - avatar
2 Respuestas
+ 1
Zohal Please, - Specify in your question tags, which language the answers were expected. I saw you mentioned `cin` so presumably C++ (add C++ to tags). - Save and share that code so everyone can see, and offer effective and efficient assistance. Just in case you didn't know how to share links. Follow this guide 👍 https://www.sololearn.com/post/74857/?ref=app
26th Nov 2019, 6:35 PM
Ipang
+ 1
Zohal Good news is (or may be bad, not sure), code runs in Code Playground. Try `#include <cstdlib>` instead of `#include <stdlib.h>`. The former is C++ way, the latter I guess was meant for C codes.
26th Nov 2019, 6:57 PM
Ipang