Write a program to make calculator in C++ Language - Program to make calculator in C++ By Vivek Bhardwaj June 10, 2022 Get link Facebook X Pinterest Email Other Apps Program to make calculator in C++ Language#include <iostream>using namespace std;int main(){ char cal; float x, y; cout << endl <<"Enter first number = "; cin>> x; cout << endl <<"Enter second number = "; cin>> y; cout << endl <<"Enter operator: "; cin>> cal; switch (cal) { case '+': cout << endl << x + y << endl; break; case '-': cout << endl << x - y << endl; break; case '*': cout << endl << x * y << endl; break; case '/': cout << endl << x / y << endl ; break; default: cout << endl << "Error!" << endl; break; } return 0;}इस कोड को हमने CODEBLOCK पर बना कर run किया हैOUTPUTFor the Addition of two numbersFor the Subtraction of two numbersFor the Multiplication of two numbersFor the Division of two numbersIf the wrong selection of operator Comments
Comments
Post a Comment