Question
I plugged in this code: #include using namespace std; void displayMenu(); void calcSum(int, int); void calcDiff(int, int); void calcProduct(int, int); void calcQuotient(int, int); int main()
I plugged in this code:
#include
using namespace std;
void displayMenu();
void calcSum(int, int);
void calcDiff(int, int);
void calcProduct(int, int);
void calcQuotient(int, int);
int main() {
int choice, num1, num2;
while (true) {
displayMenu();
cout << "Enter your choice: \t";
cin >> choice;
cout << endl << "Enter two numbers:\t";
cin >> num1 >> num2;
switch (choice) {
case 1: calcSum(num1, num2);
break;
case 2: calcDiff(num1, num2);
break;
case 3: calcProduct(num1, num2);
break;
case 4: calcQuotient(num1, num2);
break;
case 5: return 0;
default: cout << "Please enter a valid choice" << endl; } } }
void displayMenu() {
cout << "MENU" << endl;
cout << "1. ADD" << endl;
cout << "2. Subtract" << endl;
cout << "3. Multiply" << endl;
cout << "4. Divide" << endl;
cout << "5. Quit" << endl << endl; }
void calcSum(int a, int b) {
cout << "Result of addition is:\t" << a + b << endl << endl; }
void calcDiff(int a, int b) {
cout << "Result of subtraction is:\t" << a - b << endl << endl; }
void calcProduct(int a, int b) {
cout << "Result of multiplication is:\t" << a * b << endl << endl; }
void calcQuotient(int a, int b) {
if (b == 0) {
cout << "Division by 0 not allowed" << endl << endl;
return; }
cout << "Result of division is:\t" << a / b << endl << endl; }
this is what i get when i run the code:
Project/Target: "Project 3 - Debug":
The compiler's setup (GNU GCC Compiler) is invalid, so Code::Blocks cannot find/run the compiler.
Probably the toolchain path within the compiler options is not setup correctly?!
Do you have a compiler installed?
Goto "Settings->Compiler...->Global compiler settings->GNU GCC Compiler->Toolchain executables" and fix the compiler's setup.
Tried to run compiler executable 'C:\MinGW/bin/mingw32-gcc.exe', but failed!
Run aborted..
I don't know what i am doing wrong. I was using a Mac Book Pro but I switched to a Lenovo.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started