Implement an OOP in-memory table storage system in C++ with a `Table` class. It should support an `insert(key, value)` method and a `count_prefix(prefix)` method that returns the number of records where the value starts with the given string prefix. Read N rows as key-value pairs (int, string), insert them, filter by value prefix, and print the count.
Line 1: integer N. Next N lines: key and val separated by space. Last line: prefix string.
Print the number of matching records found.
0 <= N <= 50
3 1 apple 2 banana 3 apricot a
2
Records with keys 1 and 3 match the prefix 'a'.
#include <iostream>
#include <vector>
#include <string>
class Table {
public:
void insert(int key, std::string val) {
// Write your insertion logic here
}
int count_prefix(std::string prefix) {
// Write your prefix counting logic here
return 0;
}
};
int main() {
// Implement I/O logic here
return 0;
}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