Object Declaration and Variable Access

#include <iostream>
using namespace std;

class Device {
public:
    int id;
};

int main() {
    // your code here: declare Device object, assign id, and print it
    Device device1;
    device1.id = 101;
    cout<<"Device ID: "<<device1.id<<endl;
    return 0;
}
Upvote
Downvote
Loading...

Input

Expected Output

Device ID: 101