Question: I typed in this code into CodeBlocks: #include using namespace std; void displayMenu(); void calcSum(int, int); void calcDiff(int, int); void calcProduct(int, int); void calcQuotient(int, int);

I typed in this code into CodeBlocks:

#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; }

when I run it, it says:

"

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. Help Please!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!