Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Milliard
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
#include <iostream> // Milliard.cpp using namespace std; int main() { srand(time(NULL)); int h2=1000000000, h1=0, f=0, t=0, a=0; int comp = rand() % h2; int human = rand() % h2; while (f<1) { cout << endl; cout << t; cout << " " << comp; cout << " " << human; if(comp < human) { cout << " MORE"; a=comp; comp=(comp+h2)/2; h1=a;} else if(comp > human) { cout << " less"; a=comp; comp=(h1+comp)/2; h2=a;} else { cout << " win by "; cout << t << " steps"; f=1;} t++; }}
clang++
Show compiler warnings
[
+
] Compiler args
[
+
]
Show input
Compilation time: 0.62 sec, absolute running time: 0.15 sec, cpu time: 0.01 sec, memory peak: 5 Mb, absolute service time: 0,86 sec
edit mode
|
history
|
discussion
Error(s):
Too many save operations. Try again later.