COMP2113
COMP2113_ENGG1340 Programming technologies and Computer programming II [Section 2BC] [2023]
Loading...
Searching...
No Matches
test.cpp File Reference
#include <ctime>
#include <iostream>
#include <cstdlib>
Include dependency graph for test.cpp:

Go to the source code of this file.

Functions

int main ()
 
int random_num (void)
 

Function Documentation

◆ main()

int main ( void )

Definition at line 10 of file test.cpp.

10 {
11 srand(time(NULL));
12 for (int i = 0; i < 10; i++) {
13 cout << "Random number: " << random_num() << endl;
14 }
15 return 0;
16}
int random_num(void)
Definition test.cpp:6

References random_num().

Here is the call graph for this function:

◆ random_num()

int random_num ( void )

Definition at line 6 of file test.cpp.

6 {
7 return rand() % 100;
8}

Referenced by main().

Here is the caller graph for this function: