Create a `Strategy` interface with `virtual int execute(int a, int b) = 0`. Implement `AddStrategy` and `MultiplyStrategy`. Create a `Context` class that takes a `Strategy*` and executes it. Read a string (‘add’ or ‘mul’) followed by two integers. Apply the correct strategy and print ‘Result: [val]’.
String ('add' or 'mul') and two integers.Print the result of the strategy execution.
None
add 5 3
Result: 8
The Strategy pattern allows an algorithm's behavior to be selected at runtime by encapsulating interchangeable logic inside class objects.
#include <iostream>
#include <string>
class Strategy {
public:
virtual int execute(int a, int b) = 0;
};
// Implement Concrete Strategies and Context
int main() {
// Setup context, inject strategy, execute
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