Can someone show me how to implement this same type of small idea in C++ with classes?
I made a tiny program in C, which makes a typedef of a two-digit number, like this:
struct two_digit_number {
int one; // first digit
int two; // second digit
};
Then I declare some numbers:
// This means a = 05, because the 0 is in the second spot
a.one = 5;
a.two = 0;
// This means b = 03
b.one = 3;
b.two = 0;
Then I have a function which adds them:
two_digit_number c = add_two_numbers(a, b);
Start Free Trial