Click here to Skip to main content
15,895,746 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
C++
#include<iostream>
#include<math.h>
#include<iomanip>
using namespace std;

int main ()
{
    int Geometry_Calculator,Calculate_the_Area_of_a_Rectangle,width,length,Quit,choice;
    double Calculate_the_Area_of_a_Triangle,base,height;
    float Calculate_the_Area_of_a_Circle,radius;
    
    cout<<"Geometry_Calculator"<<endl;
    cout<<"1.Calculate_the_Area_of_a_Circle"<<endl;
    cout<<"2.Calculate_the_Area_of_a_Rectangle"<<endl;
    cout<<"3.Calculate_the_Area_of_a_Triangle"<<endl;
    cout<<"4.Quit"<<endl;
    cout<<"Enter_your_choice (1-4):"<<endl;
    cin>>choice;
    
    switch (choice)
    {
           
      case 1:cout<<fixed<<showpoint;
            cout<<setprecision (2); 
            cout<<"Enter radius:";
            cin>>radius;
            Calculate_the_Area_of_a_Circle=3.14159*(pow(radius,2));
            cout<<"Total_Area_of_a_Cirlce:"<<Calculate_the_Area_of_a_Circle<<endl;
            break;
      case 2:cout<<"Enter width:";
             cin>>width;
             cout<<"Enter length:";  
             cin>>length; 
             Calculate_the_Area_of_a_Rectangle=width*length;
             cout<<"Total_Area_of_a_Rectangle:"<<Calculate_the_Area_of_a_Rectangle<<endl;
         break;
      case 3:cout<<"Enter base:";
             cin>>base;
             cout<<"Enter height:";
             cin>>height;
             Calculate_the_Area_of_a_Triangle=0.5*(base*height);
             cout<<"Total_Area_of_a_Triangle:"<<Calculate_the_Area_of_a_Triangle<<endl;
         break;
      case 4:cout<<"Quit"<<endl;
         break;
      
      default:cout<<"Wrong input.Please try again."<<endl;
    }   
    
    system ("pause");
    return 0;
                
}
Posted
Updated 26-Oct-14 3:26am
v2
Comments
CPallini 26-Oct-14 9:27am    
Pseudo code is not much different fro the actual one (at least in this case) what's your problem with it?
Sergey Alexandrovich Kryukov 26-Oct-14 14:04pm    
Converting anything into pseudo-code sounds like cheating. It looks like you were required to create pseudo-code and present it. And you did not created it, but you think that you found some code. Then be honest and present this code and say "I found it"...
—SA
Kornfeld Eliyahu Peter 26-Oct-14 14:10pm    
You probably right, that we have here a 'backward' solution for a homework assignment - hope OP will learn from it...
Sergey Alexandrovich Kryukov 26-Oct-14 14:21pm    
That was my point. Thank you.
—SA

1 solution

There is no such a thing standard pseudo code, so there is no one way to convert it. Pseudo code is not more than a programming structure in human readable format rather than in actual programming language - so if you have no restrictions from your teacher/working place about pseudo code format you can do it on your way and as long as it understandable it will be all right! (And it can be non-English too!)

http://en.wikipedia.org/wiki/Pseudocode[^]
http://www.unf.edu/~broggio/cop2221/2221pseu.htm[^]
 
Share this answer
 
Comments
[no name] 26-Oct-14 9:50am    
yep! therfore my 5
Kornfeld Eliyahu Peter 26-Oct-14 9:51am    
Thank you!
Maciej Los 26-Oct-14 10:55am    
5ed!
Kornfeld Eliyahu Peter 26-Oct-14 10:57am    
Thank you!
Sergey Alexandrovich Kryukov 26-Oct-14 14:05pm    
5ed, but please also see my harsh comment to the question...
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900