How do we make a guess number coding for c++? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How do we make a guess number coding for c++?

29th Mar 2017, 8:04 AM
Yasmien Sanif
Yasmien Sanif - avatar
3 Answers
+ 3
#include <iostream> #include <cstdlib> using namespace std; int main() { int a=rand(); } This will produce random no. Now u can input by cin and use == to check whether they are equal
29th Mar 2017, 8:22 AM
Sayantan Ghosh
Sayantan Ghosh - avatar
+ 2
thank you for ur help!!
29th Mar 2017, 8:23 AM
Yasmien Sanif
Yasmien Sanif - avatar
+ 1
U need to use random function..
29th Mar 2017, 8:16 AM
Sayantan Ghosh
Sayantan Ghosh - avatar