#include <iostream>
#include <cstdint>

using namespace std;

// Create type alias for fixed-size packet
using Packet = uint8_t[8];

int main() {
    Packet pkt;
    int temp[8];

    // Read input into temporary integer array
    for (int i = 0; i < 8; ++i) {
        cin >> temp[i];
        pkt[i] = static_cast<uint8_t>(temp[i]);
    }

    // Print packet contents as numeric values
    for (int i = 0; i < 8; ++i) {
        cout << static_cast<unsigned int>(pkt[i]);
        if (i < 7) cout << " ";
    }

    return 0;
}

Solving Approach

 

 

 

 

 

Upvote
Downvote
Loading...

Input

10 20 30 40 50 60 70 80

Expected Output

10 20 30 40 50 60 70 80