I saw this piece of code which I tought was interesting. However, since i'm new o programming can someone please provice the 3 column IPO chart including the Algorithm.Thank you for an urgent response.
I greatly appreciate your prompt response as i'm having a open discussion on this on Thursday April 16, 2009 at 12:30pm.
int main()
{
// Declare variables below here
double x, z, result;
char operand;
// Initialization Section for real number output. DO NOT MOVE!
cout <<setiosflags(ios::fixed | ios::showpoint);
cout <<setprecision(2);
// Begin your "main processing" below here
cout <<"Welcome to the mathematical selector program!"<<endl;
do
{
cout <<"Please enter the operand of the problem you would like to solve:"<<endl;
cout <<"+ for addition"<<endl;
cout <<"- for subtraction"<<endl;
cout <<"* for multiplication"<<endl;
cout <<"/ for division"<<endl;
cout <<"Enter Q to quit"<<endl;
cout <<"Enter your choice ==> ";
cin>> operand;
switch (operand)
{
case 'Q':
break;
case '+':
cout <<"Please enter the two numbers ==> ";
cin >> x >> z;
result = x+z;
cout <<"The answer is: " << result <<endl;
break;
case '-':
cout <<"Please enter the two numbers ==> ";
cin >> x >> z;
result = x-z;
cout <<"The answer is: " << result <<endl;
break;
case '*':
cout <<"Please enter the two numbers ==> ";
cin >> x >> z;
result = x*z;
cout <<"The answer is: " << result <<endl;
break;
case '/':
cout <<"Please enter the two numbers ==> ";
cin >> x >> z;
if (z ==0 )
{
cout <<"That is an invalid operation" <<endl;
}
else
{
result = x/z;
cout <<"The answer is: " << result <<endl;
}
break;
default :
cout <<"That is an invalid operation" <<endl;
break;
}
}while (operand != 'Q');
cout <<"End of Program!"<<endl;
Thanks for responding. No, this is not a home work, just that i'm trying to understand certain aspects of computer science and I'm researching on Networking, Programing etc. I have a friend who understand programing i would say and is trying to teach me.
As I said its just a discussion, from what I heard programing is interesting and I would like to understand it.