"how to make a calculator inc++" Code Answer's
You're definitely familiar with the best coding language C++ that developers use to develop their projects and they get all their queries like "how to make a calculator inc++" answered properly. Developers are finding an appropriate answer about how to make a calculator inc++ related to the C++ coding language. By visiting this online portal developers get answers concerning C++ codes question like how to make a calculator inc++. Enter your desired code related query in the search bar and get every piece of information about C++ code related question on how to make a calculator inc++.
how to make a calculator inc++
// ONLY 29 LINES OF CODE IN TOTAL
// For better calculator scroll down on this post
#include <iostream>
using namespace std;
int main() {
cout << "Please enter the first number: ";
double n1 = 0;
cin >> n1;
cout << "Please enter an operator (+, -, *, /): ";
char op = '0';
cin >> op;
cout << "Please enter a second number: ";
double n2 = 0;
cin >> n2;
double answer = 0;
switch (op) {
case '+':
answer = n1 + n2;
break;
case '-':
answer = n1 - n2;
break;
case '*':
answer = n1 * n2;
break;
case '/':
answer = n1 / n2;
break;
}
cout << "Thanks for using my calculator your answer is: " << answer;
// this is the better calculator:
#include <iostream>
#include <Windows.h>
using namespace std;
int main() {
char jim = 'j';
do {
cout << "Please enter the first number: ";
double n1 = 0;
cin >> n1;
cout << "Please enter an operator (+, -, *, /): ";
char op = '0';
cin >> op;
cout << "Please enter a second number: ";
double n2 = 0;
cin >> n2;
double answer = 0;
switch (op) {
case '+':
answer = n1 + n2;
break;
case '-':
answer = n1 - n2;
break;
case '*':
answer = n1 * n2;
break;
case '/':
answer = n1 / n2;
break;
}
cout << "Thanks for using my calculator your answer is: " << answer << " do you want to run the program again? (y or n) ";
cin >> jim;
} while (jim = 'y' && jim != 'n');
if (jim = 'n') {
cout << "Thanks for using my calculator here is sum epic music";
Beep(329, 300);
Beep(493, 300);
Beep(698, 300);
Beep(659, 600);
Beep(783, 300);
Beep(698, 300);
Beep(659, 600);
Beep(329, 100);
Beep(493, 300);
Beep(698, 300);
Beep(659, 600);
Beep(392, 250);
Beep(440, 200);
Beep(587, 300);
Beep(349, 250);
Beep(587, 500);
Beep(329, 300);
Beep(493, 300);
Beep(698, 300);
Beep(659, 600);
Beep(783, 300);
Beep(698, 300);
Beep(659, 600);
Beep(329, 100);
Beep(493, 300);
Beep(698, 300);
Beep(659, 600);
Beep(392, 250);
Beep(440, 200);
Beep(587, 300);
Beep(349, 250);
Beep(587, 400);
}
return 0;
}
All those coders who are working on the C++ based application and are stuck on how to make a calculator inc++ can get a collection of related answers to their query. Programmers need to enter their query on how to make a calculator inc++ related to C++ code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about how to make a calculator inc++ for the programmers working on C++ code while coding their module. Coders are also allowed to rectify already present answers of how to make a calculator inc++ while working on the C++ language code. Developers can add up suggestions if they deem fit any other answer relating to "how to make a calculator inc++". Visit this developer's friendly online web community, CodeProZone, and get your queries like how to make a calculator inc++ resolved professionally and stay updated to the latest C++ updates.