Write a C++ program defining an `Inventory` class to manage stock additions and removals, then display the remaining stock count.
Initial stock (int), added stock (int), and sold stock (int).
Print final available stock.
Stock values >= 0
100 50 30
Final Stock: 120
Tracks dynamic stock level adjustments inside an inventory class.
#include <iostream>
class Inventory {
private:
int stock;
public:
void setStock(int s) { stock = s; }
void addStock(int qty) {
// Write your code here
}
void removeStock(int qty) {
// Write your code here
}
void display() {
std::cout << "Final Stock: " << stock << "n";
}
};
int main() {
Inventory inv;
int init, add, rem;
if (std::cin >> init >> add >> rem) {
inv.setStock(init);
inv.addStock(add);
inv.removeStock(rem);
inv.display();
}
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