Array of Objects

Medium Introduction to C++ Classes & Objects
Solve in Playground →

Problem Statement

Create a `Point` class with public integer attributes `x` and `y`. Declare an array of 3 `Point` objects. Read 6 integers from input to populate the `x` and `y` for each point. Print each point formatted as `(x, y)` on separate lines.

Input Format

6 space-separated integers.

Output Format

Print each point on a new line.

Constraints

None

Sample Input

1 2 3 4 5 6

Sample Output

(1, 2)
(3, 4)
(5, 6)

Explanation

You can create contiguous arrays of objects just like standard primitive data types.

Starter Code

#include <iostream>

class Point {
public:
    // Define attributes here
};

int main() {
    // Declare array of 3 Points, read input, and print
    return 0;
}

Limits

  • Time Limit: 1s
  • Memory Limit: 256MB

Embedded C Programming

Updated: March 15, 2026
Intermediate

Embedded systems rely on efficient low-level programming to interact directly with hardware. In this course, you will learn how to write practical Embedded C programs used in real microcontroller-based systems. Rather than focusing only on theory, this course follows a practice-driven approach. Each lesson includes hands-on coding exercises that simulate real firmware development tasks used