Greetings guys,
can you please check my pseudo code for me ?
this is my calculator program
#include <iostream>
using namespace std;
int main()
{
double number1, number2;
double answer;
char operation, option;
bool bValidOP;
do
{
cout <<"===================== Welcome ===================" << endl;
cout << endl << "======== Summoner ===============================" << endl;
cout << endl << "=============================== to ========" << endl;
cout << endl << "=========== Math ============================" << endl;
cout << endl << "===================== World =====================" << endl;
cout << endl << endl << "Please Summoner Would you insert the First number" << endl;
cout << endl;
while (!(cin >> number1))
{
cout << endl << "Invalid Input please Summoner insert Numbers only" << endl << endl;
cin.clear();
cin.ignore(1000,'\n');
}
p:
cout << endl << "Please Choose One of those four Operators (+,-,/,*)" << endl;
cout << endl;
cin >> operation;
bValidOP = false;
cout << endl << "Please Summoner Would you insert the Second number" << endl;
cout << endl;
while (!(cin >> number2))
{
cout << endl << "Invalid Input please Summoner insert Numbers only" << endl << endl;
cin.clear();
cin.ignore(1000,'\n');
}
switch(operation)
{
case '+' :
answer = number1 + number2;
cout << endl << "The Answer Is : " << answer << endl;
cout << endl << endl << "================================" << endl;
cout << endl << "====== Thank You Summoner ======" << endl;
cout << endl << "================================" << endl << endl;
break;
case '-' :
answer = number1 - number2;
cout << endl << "The Answer Is : " << answer << endl;
cout << endl << endl << "================================" << endl;
cout << endl << "====== Thank You Summoner ======" << endl;
cout << endl << "================================" << endl << endl;
break;
case '/' :
answer = number1 / number2;
cout << endl << "The Answer Is : " << answer << endl;
cout << endl << endl << "================================" << endl;
cout << endl << "====== Thank You Summoner ======" << endl;
cout << endl << "================================" << endl << endl;
break;
case '*' :
answer = number1 * number2;
cout << endl << "The Answer Is : " << answer << endl;
cout << endl << endl << "================================" << endl;
cout << endl << "====== Thank You Summoner ======" << endl;
cout << endl << "================================" << endl << endl;
break;
default :
bValidOP = false;
cout << endl << endl << "You have entered an invalid Operator" << endl << endl;
goto p;
break;
}
cout << endl << "Please do you want to roll again Summoner?\n" << endl;
cin >> option;
cout << endl << endl;
} while ((option !='N') && (option !='n'));
system("pause");
return 0;
}
and this is my pseudo code
START
REPEAT
PRINT ===================== Welcome ===================
PRINT ======== Summoner ===============================
PRINT =============================== to ========
PRINT =========== Math ============================
PRINT ===================== World =====================
PRINT Please Summoner Would you insert the First number
WHILE number1 NOT EQUAL double
PRINT Invalid Input please Summoner insert Numbers only
READ Clear
READ Ignore 1000
ENDWHILE
p:
PRINT Please Choose One of those four Operators (+,-,/,*)
READ operation
bValidOP is EQUAL false
PRINT Please Summoner Would you insert the Second number
WHILE number2 NOT EQUAL double
PRINT Invalid Input please Summoner insert Numbers only
READ Clear
READ Ignore 1000
ENDWHILE
CASE operation OF
'+' :
answer = number1 + number2
PRINT The Answer Is :
PRINT ================================
PRINT ====== Thank You Summoner ======
PRINT ================================
STOP
'-' :
answer = number1 - number2
PRINT The Answer Is :
PRINT ================================
PRINT ====== Thank You Summoner ======
PRINT ================================
STOP
'/' :
answer = number1 / number2
PRINT The Answer Is :
PRINT ================================
PRINT ====== Thank You Summoner ======
PRINT ================================
STOP
'*' :
answer = number1 * number2
PRINT The Answer Is :
PRINT ================================
PRINT ====== Thank You Summoner ======
PRINT ================================
STOP
default
bValidOP = false
PRINT You have entered an invalid Operator
goto p
STOP
ENDCASE
PRINT Please do you want to roll again Summoner?
READ option
UNTIL option NOT EQUAL 'N' and 'n'
END
thanks a lot