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

Go to the source code of this file.

Functions

void g (int &k)
 
int main ()
 

Function Documentation

◆ g()

void g ( int & k)

Definition at line 23 of file checkpoint5.2.cpp.

23 {
24 static int num = 6;
25
26 if (k % 2 == 0){
27 num += 2;
28 k = k + 6;
29 }
30 else{
31 num -= 2;
32 k = k - 6;
33 }
34 cout << num << ", " << k << endl;
35}

Referenced by main().

Here is the caller graph for this function:

◆ main()

int main ( void )

Definition at line 6 of file checkpoint5.2.cpp.

6 {
7 int y = 9;
8 int x = 7;
9 int i = 0;
10
11 while (i < 3){
12 if (i % 2 == 0){
13 g(x);
14 i++;
15 }
16 else{
17 g(y);
18 i++;
19 }
20 }
21}
void g(int &k)

References g().

Here is the call graph for this function: