C++ Online Compiler & Playground
HTML/CSS/JavaScript
HTML
CSS
Javascript
C++
C
PHP
Java
Python
Swift
C#
Ruby
Node.JS
Kotlin
jQuery
Go
R
TypeScript
Start C++ Course
Register
Q&A #2
0
Author: Shahil Ahmed
Dark
Public
Save
CPP
cpp
1
2
3
4
5
6
7
8
9
10
#include
<
iostream
>
#include
<
cstdlib
>
#include
<
ctime
>
using
namespace
std
;
int
main
()
{
srand
(
time
(
0
));
// (time(NULL)) also works
cout
<<
rand
();
return
0
;
}
Enter to Rename, Shift+Enter to Preview
OUTPUT