Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hello, here is my original code . I need to make a GUI for it. can you please ma

ID: 3829589 • Letter: H

Question

Hello,

here is my original code . I need to make a GUI for it. can you please make a GUI for me?
(C++ data strucs algorithms)

Thanks!

CODE::

#include
#include
#include
using namespace std;

//The main function
void main()
{
//Charecter type variables to store
char letter;
char letter1;
char letter2;
char letter3;
char letter4;

//Integer type variables to hold operands
int a, b;

//Double type variables to hold operands
double a1, b1;

//To store integer type result
int result;

//to store float type result
double result1;

//To print the header
cout << " ***************** SCIENTIFIC CALCULATOR ****************** ";
//The do while loop to reapt the program untill user enter exit
do
{
//display the menu
cout << " 1 : Arithmetic Operations ";
cout << " 2 : Trigonometric Functions ";
cout << " 3 : Logarithmic Functions ";
cout << " 4 : Power Functions ";
cout << " 5 : Exit... ";

//Take the input choice
cin >> letter;

//The swich loop to process various choices
switch (letter)
{
//If user select to perform Arithmetic Operations
case '1':
{
//Display the sub menu
cout << " ";
cout << " 1 : Addition ";
cout << " 2 : Subtraction ";
cout << " 3 : Multipilication ";
cout << " 4 : Division ";

//read the choice
cin >> letter1;

//the swich loop to process the user selected arithematic operation
switch (letter1)
{
//if user selected to add
case '1':
{
//Display the message
cout << " Enter first number...";

//read the first number
cin >> a;

//Display the message
cout << "Enter an other number...";

//read the first number
cin >> b;

//Perform the operation and store the result in result
result = a + b;

//display the result
cout << " Result = " << result << endl;
  
//Break the case
break;
}

//If the user select to subtract
case '2':
{
//Display the message
cout << " Enter first number...";

//read the first number
cin >> a;

//Display the message
cout << "Enter an other number...";

//read the second number
cin >> b;

//perform the subtraction operation
result = a - b;

//display the result
cout << " Result = " << result << endl;
  
//break the case
break;
}

//If user selects multiplication operation
case '3':
{
////Display the message
cout << " Enter first number...";

//read the first number
cin >> a;

//Display the message
cout << "Enter an other number...";
  
//Display the message
cin >> b;

//perform the operation and store the result in result
result = a * b;

//display the result
cout << " Result = " << result << endl;
  
//break the case statement
break;
}

//if user selects division operation
case '4':
{

//Display the message
cout << " Enter first number...";
  
//reaad the first number
cin >> a;
  
//Display the message
cout << "Enter an other number...";
  
//Display the message
cin >> b;
  
//if numerator is not zero
//a logical mistake is here actally b!=0 has to be checked
//The denominator should not be zero
if (a != 0)
{
//perform the operation and the result is in result
result = a / b;

//display the result
cout << " Result = " << result << endl;
}

//break the case
break;
}
} // end of inner switch
//break the case 1 of outer switch
break;
} // end of case 1 arithmatic operation
  
//if user selects Trigonometric Functions
case '2':
{
//diaplay the sub menu
cout << " ";
cout << " 1 : Sin function ";
cout << " 2 : Cos function ";
cout << " 3 : Tan function ";

//read the choice entered by the user
cin >> letter2;

//The switch to process various choices
switch (letter2)
{
//If user input 1, that is Sin function
case '1':
{
//Display the message
cout << " Enter a number...";

//read the number from user
cin >> a1;

//perform the operation, since the result is double store it in result2
result1 = (sin(a1));

//diaply the result
cout << " Result = " << result1 << endl;
  
//break the case
break;
}

//If user input 2, that is Cos function
case '2':
{
//Display the messag
cout << " Enter a number...";

//read the number from user
cin >> a1;

//perform the operation, since the result is double store it in result2
result1 = (cos(a1));

//diaply the result
cout << " Result = " << result1 << endl;
  
//break the case
break;
}

//If user input 3, that is Tan function
case '3':
{
//Display the message
cout << " Enter a number...";

//read the number from user
cin >> a1;

//perform the operation, since the result is double store it in result2
result1 = (tan(a1));

//diaply the result
cout << " Result = " << result1 << endl;
  
//break the case
break;
}
} // inner switch
break;
} // inner case 2 trignomatic

//if user selects Logarithmic Functions
case '3':
{
//Display the inner menu
cout << " ";
cout << " 1 : Natural log ";
cout << " 2 : log with base 10 ";

//read the user choice
cin >> letter3;

//Switch to process user choices
switch (letter3)
{
  
//if user selects natural log
case '1':
{
//Display the message
cout << " Enter a number...";

//read the input number
cin >> a1;

//perform the operation
result1 = log(a1);

//display the result
cout << " Result = " << result1 << endl;

//break the case
break;
}

//if user selects base 10 log
case '2':
{
//Display the message
cout << " Enter a number...";

//read the number from user
cin >> a1;

//perform the operation
result1 = log10(a1);

//display the result
cout << " Result = " << result1 << endl;

//break the case
break;
}
} // end of switch
break;
} // end of case 3 logrithmic

//if user selects power operations
case '4':
{
//diaplay the inner menu
cout << "1) Press 1 for Power ";
cout << "2) Press 2 for Square root ";
cout << "Enter your choice....";

//read the user input
cin >> letter4;

//The switch to process user choice
switch (letter4)
{
//if user selects power
case '1':
{
//Display the message
cout << " Enter a number...";
  
//read the first number
cin >> a1;
  
//Display the message
cout << "Enter power...";
//read the power
cin >> b1;

//perform the operation
result1 = pow(a1, b1);

//display the result
cout << " Result = " << result1 << endl;

//break the case
break;
}

//if user selects square root
case '2':
{
//Display the message
cout << " Enter a number...";

//read the number
cin >> a;

//find the square root
result1 = sqrt(a);

//Display the message
cout << " Result = " << result1 << endl;

//break the case
break;
}
} // end of switch
break;
} // end of case power function
} // outer switch
} while (letter != '5');//reepat while user not enter 5
  
}

Explanation / Answer

made some changes. you haven't specified that in which language u wanted the GUI.

Fallowing program run properly just check it out

#include <iostream>
#include <cmath>
using namespace std;

int main() {
   // your code goes here
   //Charecter type variables to store
char letter;
char letter1;
char letter2;
char letter3;
char letter4;
//Integer type variables to hold operands
int a, b;
//Double type variables to hold operands
double a1, b1;
//To store integer type result
int result;
//to store float type result
double result1;
//To print the header
cout << " ***************** SCIENTIFIC CALCULATOR ****************** ";
//The do while loop to reapt the program untill user enter exit
do
{
//display the menu
cout << " 1 : Arithmetic Operations ";
cout << " 2 : Trigonometric Functions ";
cout << " 3 : Logarithmic Functions ";
cout << " 4 : Power Functions ";
cout << " 5 : Exit... ";
//Take the input choice
cin >> letter;
//The swich loop to process various choices
switch (letter)
{
//If user select to perform Arithmetic Operations
case '1':
{
//Display the sub menu
cout << " ";
cout << " 1 : Addition ";
cout << " 2 : Subtraction ";
cout << " 3 : Multipilication ";
cout << " 4 : Division ";
//read the choice
cin >> letter1;
//the swich loop to process the user selected arithematic operation
switch (letter1)
{
//if user selected to add
case '1':
{
//Display the message
cout << " Enter first number...";
//read the first number
cin >> a;
//Display the message
cout << "Enter an other number...";
//read the first number
cin >> b;
//Perform the operation and store the result in result
result = a + b;
//display the result
cout << " Result = " << result << endl;
  
//Break the case
break;
}
//If the user select to subtract
case '2':
{
//Display the message
cout << " Enter first number...";
//read the first number
cin >> a;
//Display the message
cout << "Enter an other number...";
//read the second number
cin >> b;
//perform the subtraction operation
result = a - b;
//display the result
cout << " Result = " << result << endl;
  
//break the case
break;
}
//If user selects multiplication operation
case '3':
{
////Display the message
cout << " Enter first number...";
//read the first number
cin >> a;
//Display the message
cout << "Enter an other number...";
  
//Display the message
cin >> b;
//perform the operation and store the result in result
result = a * b;
//display the result
cout << " Result = " << result << endl;
  
//break the case statement
break;
}
//if user selects division operation
case '4':
{
//Display the message
cout << " Enter first number...";
  
//reaad the first number
cin >> a;
  
//Display the message
cout << "Enter an other number...";
  
//Display the message
cin >> b;
  
//if numerator is not zero
//a logical mistake is here actally b!=0 has to be checked
//The denominator should not be zero
if (a != 0)
{
//perform the operation and the result is in result
result = a / b;
//display the result
cout << " Result = " << result << endl;
}
//break the case
break;
}
} // end of inner switch
//break the case 1 of outer switch
break;
} // end of case 1 arithmatic operation
  
//if user selects Trigonometric Functions
case '2':
{
//diaplay the sub menu
cout << " ";
cout << " 1 : Sin function ";
cout << " 2 : Cos function ";
cout << " 3 : Tan function ";
//read the choice entered by the user
cin >> letter2;
//The switch to process various choices
switch (letter2)
{
//If user input 1, that is Sin function
case '1':
{
//Display the message
cout << " Enter a number...";
//read the number from user
cin >> a1;
//perform the operation, since the result is double store it in result2
result1 = (sin(a1));
//diaply the result
cout << " Result = " << result1 << endl;
  
//break the case
break;
}
//If user input 2, that is Cos function
case '2':
{
//Display the messag
cout << " Enter a number...";
//read the number from user
cin >> a1;
//perform the operation, since the result is double store it in result2
result1 = (cos(a1));
//diaply the result
cout << " Result = " << result1 << endl;
  
//break the case
break;
}
//If user input 3, that is Tan function
case '3':
{
//Display the message
cout << " Enter a number...";
//read the number from user
cin >> a1;
//perform the operation, since the result is double store it in result2
result1 = (tan(a1));
//diaply the result
cout << " Result = " << result1 << endl;
  
//break the case
break;
}
} // inner switch
break;
} // inner case 2 trignomatic
//if user selects Logarithmic Functions
case '3':
{
//Display the inner menu
cout << " ";
cout << " 1 : Natural log ";
cout << " 2 : log with base 10 ";
//read the user choice
cin >> letter3;
//Switch to process user choices
switch (letter3)
{
  
//if user selects natural log
case '1':
{
//Display the message
cout << " Enter a number...";
//read the input number
cin >> a1;
//perform the operation
result1 = log(a1);
//display the result
cout << " Result = " << result1 << endl;
//break the case
break;
}
//if user selects base 10 log
case '2':
{
//Display the message
cout << " Enter a number...";
//read the number from user
cin >> a1;
//perform the operation
result1 = log10(a1);
//display the result
cout << " Result = " << result1 << endl;
//break the case
break;
}
} // end of switch
break;
} // end of case 3 logrithmic
//if user selects power operations
case '4':
{
//diaplay the inner menu
cout << "1) Press 1 for Power ";
cout << "2) Press 2 for Square root ";
cout << "Enter your choice....";
//read the user input
cin >> letter4;
//The switch to process user choice
switch (letter4)
{
//if user selects power
case '1':
{
//Display the message
cout << " Enter a number...";
  
//read the first number
cin >> a1;
  
//Display the message
cout << "Enter power...";
//read the power
cin >> b1;
//perform the operation
result1 = pow(a1, b1);
//display the result
cout << " Result = " << result1 << endl;
//break the case
break;
}
//if user selects square root
case '2':
{
//Display the message
cout << " Enter a number...";
//read the number
cin >> a;
//find the square root
result1 = sqrt(a);
//Display the message
cout << " Result = " << result1 << endl;
//break the case
break;
}
} // end of switch
break;
} // end of case power function
} // outer switch
} while (letter != '5');//reepat while user not enter 5
  
}
  

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote