Simple C User defined shape enumeration datad type Consider

Simple C++: User defined shape, enumeration datad type

Consider the set Ropf of real numbers, and define the function rho: Ropf times Ropf rightarrow [0, infinity) by rho(x, y):= |x - y|/1 + |x - y| Show that rho defines a metric on Ropf. Show that each set of the form F_n:= [n, infinity) is closed in (Ropf, rho).

Solution

#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <iostream>

using namespace std;

enum shape{
   TRIANGLE,
   RECTANGLE,
   PARALLEOGRAM,
   SQUARE
};
int main(int argc, char *argv[]) {
       int option;
       double h,l;
       cout << \"\ 0.Triangle()\ 1.Rectangle()\ 2.Parallelogram()\ 3.Square ()\ choose the shape to find the area:\\t\";
       cin >> option;
   //   shape s = option;
       switch(option){
           case TRIANGLE:
               cout << \"Enter height and length of triangle base:\\t\";
               cin >> h >> l;
               cout << \"Area of TRIANGLE is:\\t\" << 0.5*h*l << \"\ \";
               break;
           case RECTANGLE:
               cout << \"Enter height and length of rectangle base:\\t\";
               cin >> h >> l;
               cout << \"Area of RECTANGLE is:\\t\" << h*l << \"\ \";
               break;
           case PARALLEOGRAM:
               cout << \"Enter height and length of peralleogram base:\\t\";
               cin >> h >> l;
               cout << \"Area of PARALLEOGRAM is:\\t\" << h*l << \"\ \";
               break;
           case SQUARE:
               cout << \"Enter length of square :\\t\";
               cin >> l;
               cout << \"Area of SQUARE is:\\t\" << l*l <<\"\ \"; break;
              
       }
   return 0;
}

Simple C++: User defined shape, enumeration datad type Consider the set Ropf of real numbers, and define the function rho: Ropf times Ropf rightarrow [0, infini

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site