CPP
cpp
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
#include <iostream>
//forward declaration for desired functions
int checkCase(int x /*first 2 coins*/, int y /*the next pair of 2 coins*/);
int checkWeight(int z /*original coin*/, int c /*problematic coin*/);
int main() {
//user input & weight assignment to the coins
unsigned int coin1{};
std::cout << "The weight of coin 1 is: ";
std::cin >> coin1;
unsigned int coin2{};
std::cout << "\nThe weight of coin 2 is: ";
std::cin >> coin2;
unsigned int coin3{};
std::cout << "\nThe weight of coin 3 is: ";
std::cin >> coin3;
unsigned int coin4{};
std::cout << "\nThe weight of coin 4 is: ";
std::cin >> coin4;
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run