Calculator

Easy Decision Making
Solve in Playground →

Problem Statement

Write a C++ program implementing a basic arithmetic calculator using a `switch` statement for operators ‘+’, ‘-‘, ‘*’, and ‘/’.

Input Format

Two numbers A and B, followed by an operator character OP.

Output Format

Print the result formatted to 2 decimal places, or 'Error: Division by zero' if dividing by 0.

Constraints

OP is one of +, -, *, /

Sample Input

10.0 5.0 +

Sample Output

15.00

Explanation

Uses switch-case routing to perform arithmetic operations based on operator symbols.

Starter Code

#include <iostream>
#include <iomanip>

int main() {
    double a, b;
    char op;
    if (std::cin >> a >> b >> op) {
        // Write your code here
    }
    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