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.
Many national flags are very similar except for the colors . write a class Scandinavian_flag that can construct the flags of Denmark, Finland, and Sweden, and a main which creates each flag like this: Scandinavian_flag Denmark{white, red}; and so on, and draws all three flags with the country name underneath. Name your progam hw6pr3.cpp. Note: Don \'t worry about any variations in the proportions of the different flags, just make the flags recognizable as belonging to that country.Solution
#include <iostream>
using namespace std;
 class Scandinavian_flag
 {
 private:
 int flag_color[3];
 const char* colors[6] = {
 \"Red\",
 \"White\",
 \"Blue\",
 \"Yellow\",
        \"Gold\"
 };
 public:
 Scandinavian_flag(int a,int b,int c=-1)
 {
 flag_color[0]=a;
 flag_color[1]=b;
 flag_color[2]=c;
 }
 void print_flag_colors()
 {
 int i=0;
 cout<<\"Flag_Colors are:\ \";
 for(i=0;i<3;i++)
 {
 if(flag_color[i]!=-1)
 {
 cout<<\"Color \"<<i+1<<\" is \"<<colors[flag_color[i]]<<\"\ \";
 }
 }
 }
 };
int main()
 {
 enum Color {
 Red = 0, // although it will also be 0 if you don\'t write this
 White, // this will be 1
 Blue,
 Yellow,
        Gold
 };
 Scandinavian_flag Denmark{Red,White};
 Scandinavian_flag Finland{Blue,White};
 Scandinavian_flag Sweden{Blue,Yellow,Gold};
 cout<<\"Denmark \";
 Denmark.print_flag_colors();
 cout<<\"Finland \";
 Finland.print_flag_colors();
 cout<<\"Sweden \";
 Sweden.print_flag_colors();
 return 0;
 }
Note: try and catch section given in the question could be added to the code.


