Build a University and Professor System

Medium Composition & Aggregation PRO
🔒 Login to Unlock

Problem Statement

Use aggregation. Build `University` and `Professor`. The `University` holds an `std::vector` internally. A `Professor` pointer is passed into the `University` via a `hire(Professor* prof)` method. Print ‘Uni: [u_name]\nProf: [p_name]’.

Input Format

Two strings: University name then Professor name.

Output Format

Print the assigned structures on two lines.

Constraints

No spaces in strings.

Sample Input

MIT Dr.Smith

Sample Output

Uni: MIT
Prof: Dr.Smith

Explanation

A complete aggregation example. The professor exists completely independently of the university's lifespan using standard vectors of pointers.

Starter Code

#include <iostream>
#include <string>
#include <vector>

class Professor {
public:
    // Write your code here
};

class University {
public:
    // Write your code here
};

int main() {
    // Wire them up using aggregation
    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