Car Class

Easy Classes & Objects
Solve in Playground →

Problem Statement

Write a C++ program defining a `Car` class with brand, model, and year, and printing its details through a member function.

Input Format

Brand (string), Model (string), and Year (int).

Output Format

Print car details.

Constraints

Year > 1800

Sample Input

Toyota Camry 2021

Sample Output

Brand: Toyota, Model: Camry, Year: 2021

Explanation

Models multi-attribute entities using objects.

Starter Code

#include <iostream>
#include <string>

class Car {
public:
    std::string brand;
    std::string model;
    int year;
    
    void display() {
        // Write your code here
    }
};

int main() {
    Car c;
    if (std::cin >> c.brand >> c.model >> c.year) {
        c.display();
    }
    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