Programming language is C Code must include exceptionhandlin

Programming language is C++. Code must include exception-handling framework too. Show code and output when done.

Solution

Solution:

#include \"Simple_window.h\"

#include \"Graph.h\"

//class for scandi

class Scandinavian_flag

{

     public:

     // constructor to initialize the color

     Scandinavian_flag(Color clm, Color blm):cross{clm}, background{blm} {}

     // method to draw the flags

     void flagdrw(Simple_window& w, int xloc, int yloc)

     {

valrw.push_back(new Rectangle{Point{xloc,yloc}, 175, 100});

          valrw[valrw.size()-1].set_color(Color::invisible);

          valrw[valrw.size()-1].set_fill_color(background);

valrw.push_back(new Rectangle{Point{xloc+50,yloc}, 20, 100});

          valrw[valrw.size()-1].set_color(Color::invisible);

          valrw[valrw.size()-1].set_fill_color(cross);

valrw.push_back(new Rectangle{Point{xloc,yloc+43}, 175, 20});

          valrw[valrw.size()-1].set_color(Color::invisible);

          valrw[valrw.size()-1].set_fill_color(cross);

          for(int lp=0; lp<valrw.size(); ++lp)

          {

              w.attach(valrw[lp]);

          }

     }

     private:

          Color cross, background;

          int valrw[100];

}

// main method with exception handling

int main()

try

{

     Simple_window win(Point(100,100),600,400, \"Flag\");

     Scandinavian_flag Denmark(white,red);

     Denmark.flagdrw(win, 0,0);

     Scandinavian_flag Finland(yellow,blue);

     Finland.flagdrw(win, 200,0);

     Scandinavian_flag Sweden(blue,white);

     Sweden.flagdrw(win, 200,400);

     return 0;

}

catch(exception& e)

{

     cerr<<\"error:\"<<e.what()<<\'\ \';

     keep_window_open();

     return 1;

    

}

Programming language is C++. Code must include exception-handling framework too. Show code and output when done.SolutionSolution: #include \
Programming language is C++. Code must include exception-handling framework too. Show code and output when done.SolutionSolution: #include \

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site