...
/Solution: Build a Calculator Application
Solution: Build a Calculator Application
This lesson provides a solution to the challenge given in the previous lesson.
We'll cover the following...
Solution #
Here is the program that will perform functionalities of a calculator.
Press + to interact
import std.stdio;import std.string;void main() {string operation = "add";double first=8;double second=4;double result;final switch (operation) {case "add":result = first + second;break;case "subtract":result = first - second;break;case "multiply":result = first * second;break;case "divide":result = first / second;break;}writeln(result);}