All submissions
#include <iostream>
#include <cstdint>
using namespace std;

class Register8 {
private:
    uint8_t value;
public:
    void setValue(uint8_t v) { value = v; }

        // your code here: declare a friend function printRegister(const Register8& r)
    friend void printRegister(const Register8& r);
};

void printRegister(const Register8& r)
{
    std::cout<<"Register value = "<<(uint16_t)r.value<<std::endl;
}



// your code here: implement printRegister that prints "Register value = <value>"

int main() {
    Register8 r;
    r.setValue(170);
    printRegister(r);
    return 0;
}
Loading...

Input

Expected Output

Register value = 170