COMP2113
COMP2113_ENGG1340 Programming technologies and Computer programming II [Section 2BC] [2023]
Loading...
Searching...
No Matches
checkpoint5.2.cpp
Go to the documentation of this file.
1
#include <iostream>
2
using namespace
std;
3
4
void
g
(
int
& k);
5
6
int
main
(){
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
}
22
23
void
g
(
int
& k){
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
}
g
void g(int &k)
Definition
checkpoint5.2.cpp:23
main
int main()
Definition
checkpoint5.2.cpp:6
Module5
checkpoint5.2.cpp
Generated on Sun Sep 29 2024 16:39:53 for COMP2113 by
1.12.0