-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathakm ammo
More file actions
31 lines (26 loc) · 899 Bytes
/
akm ammo
File metadata and controls
31 lines (26 loc) · 899 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <iostream>
using namespace std;
int main() {
const int maxAmmo = 32;
const int maxReloads = 3;
int ammo = maxAmmo;
int reloads = 0;
cout << "AKM Ammo: " << ammo << endl;
// Loop until ammo runs out or maximum reloads reached
while (ammo > 0 && reloads < maxReloads) {
// Simulate firing
for (int i = 0; i < maxAmmo; ++i) {
cout << "Firing shot " << (i + 1) << endl;
--ammo; // Decrease ammo count for each shot
if (ammo == 0) {
cout << "Out of ammo. Reloading..." << endl;
++reloads; // Increase reload count when ammo runs out
ammo = maxAmmo; // Reload the gun with full ammo
break; // Exit firing loop
}
}
}
cout << "AKM Ammo: " << ammo << endl;
cout << "Reloads used: " << reloads << endl;
return 0;
}