repl.it
@themaka/

rand() max

C++

No description

fork
loading
Files
  • main.cpp
  • main
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <iostream>
#include <cstdlib>

using namespace::std;

int main() {
  int a, a_max;
  for(int i=0; i<100000; i++)
  {
    a = rand();
    if (a > a_max)
    {
      cout << "New max found.\n";
      a_max = a;
    }
  }
  cout << a_max << " is the found max.\n";
  return 0;
}
Fetching token
?