title: C++ change from struct to classes
body: <p>I am looking to change this from struct to classes and use a header file to hold the class. </p>
  
  <p>What would you suggest in way of changing it over. The code all works. There is no problem there. just a simple change over question. </p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;cstdlib&gt;
  using namespace std;
  struct printype
  {
      char dots[8][15];
      int unknown15;          //  can have values of 0..127
      string serial11_14;     //  8 characters 00000000...99999999
      int year8;              //  without century, 0..99
      int month7;             //  1..12
      int day6;               //  1..31
      int hour5;              //  0..23
      int minute2;            //  0..59
  };                              
  int getunknown15(); // prototypes       
  string getserial11_14();    
  int getyear8();                 
  int getmonth7();            
  int getday6();              
  int gethour5();                 
  int getminute2();   
  int setunknown15(int);          //------------------------- protos
  string setserial11_14(string);  
  int setyear8(int);              
  int setmonth7(int);             
  int setday6(int);               
  int sethour5(int);              
  int setminute2(int);            
  // int array and display info for array
  void setup(char[8][15]);
  // display array
  void darray(char[8][15]);
  //  displays printer information
  void dpinfo(printype);
  // set parrity
  void spar(char[8][15]); 
  // fill array
  void ftarray(printype &amp;);       //----------------------end protos
  //-------------------------------------
  
  
  void main ()
  {
      printype pt;
      pt.unknown15=getunknown15();
      pt.unknown15=setunknown15(pt.unknown15);
      pt.serial11_14=getserial11_14();
      pt.serial11_14=setserial11_14(pt.serial11_14);
      pt.year8=getyear8();
      pt.year8=setyear8(pt.year8);
      pt.month7=getmonth7();
      pt.month7=setmonth7(pt.month7);
      pt.day6=getday6();
      pt.day6=setday6(pt.day6);
      pt.hour5=gethour5();
      pt.hour5=sethour5(pt.hour5);
      pt.minute2=getminute2();
      pt.minute2=setminute2(pt.minute2);
      cout &lt;&lt;"-----------------------------------------------------"&lt;&lt;endl;
      cout &lt;&lt;" Lets Get Started"&lt;&lt;endl;
      cout &lt;&lt;"-----------------------------------------------------"&lt;&lt;endl;
      setup(pt.dots);             // sets up the array 
      dpinfo(pt);                 // prints out the final array
      ftarray(pt);
      spar(pt.dots);
      darray(pt.dots);
  }
  
  
  int getunknown15()
  {
      printype tem;
      cout &lt;&lt;"-----------------------------------------------------"&lt;&lt;endl;
      cout &lt;&lt;" Enter the Unkown Variable (0-127):  ";
      cin  &gt;&gt;tem.unknown15;
      cout &lt;&lt;"-----------------------------------------------------"&lt;&lt;endl;
      return tem.unknown15;
  }
  string getserial11_14()//------------------------------------------ starts the get information sets
  {
      printype tem;
      cout &lt;&lt;" Enter the Serial Variable (8char long):  ";
      cin  &gt;&gt;tem.serial11_14;
      cout &lt;&lt;"-----------------------------------------------------"&lt;&lt;endl;
      return tem.serial11_14;
  }
  int getyear8()
  {
      printype tem;
      cout &lt;&lt;" Enter the Year Variable (2char long):  ";
      cin  &gt;&gt;tem.year8;
      cout &lt;&lt;"-----------------------------------------------------"&lt;&lt;endl;
      return tem.year8;
  }
  int getmonth7()
  {
      printype tem;
      cout &lt;&lt;" Enter the Month Variable (2char long):  ";
      cin  &gt;&gt;tem.month7;
      cout &lt;&lt;"-----------------------------------------------------"&lt;&lt;endl;
      return tem.month7;
  }
  int getday6()
  {
      printype tem;
      cout &lt;&lt;" Enter the Day Variable (2char long):  ";
      cin  &gt;&gt;tem.day6;
      cout &lt;&lt;"-----------------------------------------------------"&lt;&lt;endl;
      return tem.day6;
  }
  int gethour5()
  {
      printype tem;
      cout &lt;&lt;" Enter the Hour Variable (2char long):  ";
      cin  &gt;&gt;tem.hour5;
      cout &lt;&lt;"-----------------------------------------------------"&lt;&lt;endl;
      return tem.hour5;
  }
  int getminute2()
  {
      printype tem;
      cout &lt;&lt;" Enter the Minute Variable (2char long):  ";
      cin  &gt;&gt;tem.minute2;
      cout &lt;&lt;"-----------------------------------------------------"&lt;&lt;endl;
      return tem.minute2;
  }
  //-----------------------------------------------------------put functions (adds info to the array)
  
  int setunknown15(int tem)
  {
      printype pp;
  
  
      if (tem&gt;127||tem&lt;0)
      {
          cout &lt;&lt; "Error" &lt;&lt; endl;
          return 0;
      }
      else
      {
          pp.unknown15 = tem;
          return pp.unknown15;
      }
  }
  string setserial11_14(string tem)
  {
      printype pp;
      if(tem.size() !=8)
      {
          cout &lt;&lt;"nope.jpg"&lt;&lt;endl;
          return 0;
      }
      else
      {
          for (int i = 0; i &lt; 8; i++)
          {
              if(!isdigit(tem.at(i)))
              {
                  cout&lt;&lt;"nope.jpg"&lt;&lt;endl;
                  return 0;
              }
          }
          pp.serial11_14=tem;
          return pp.serial11_14;
      }
  }
  int setyear8(int tem)
  {
      printype pp;
      if(tem&gt;99||tem&lt;0)
      {
          cout&lt;&lt;"nope.jpg"&lt;&lt;endl;
          return 0;
      }
      else
      {
          pp.year8=tem;
          return pp.year8;
      }
  }
  int setmonth7(int tem)
  {
      printype pp;
      if(tem&gt;12||tem&lt;1)
      {
          cout&lt;&lt;"nope.jpg"&lt;&lt;endl;
          return 0;
      }
      else
      {
          pp.month7=tem;
          return pp.month7;
      }
  }
  int setday6(int tem)
  {
      printype pp;
      if(tem&gt;31||tem&lt;1)
      {
          cout&lt;&lt;"nope.jpg"&lt;&lt;endl;
          return 0;
      }
      else
      {
          pp.day6=tem;
          return pp.day6;
      }
  }int sethour5(int tem)
  {
      printype pp;
      if(tem&gt;23||tem&lt;0)
      {
          cout&lt;&lt;"nope.jpg"&lt;&lt;endl;
          return 0;
      }
      else
      {
          pp.hour5=tem;
          return pp.hour5;
      }
  }
  int setminute2(int tem)
  {
      printype pp;
      if(tem&gt;59||tem&lt;0)
      {
          cout&lt;&lt;"nope.jpg"&lt;&lt;endl;
          return 0;
      }
      else
      {
          pp.minute2=tem;
          return pp.minute2;
      }
  }
  void setup(char tem[8][15])
  {
      for (int x=0;x&lt;8;x++)// set to all blanks
      {
          for (int y=0;y&lt;15;y++)
          {
              tem[x][y]=' ';
          }
      }
  }
  void darray(char tem[8][15])
  {
      for (int x=0;x&lt;8;x++)// set to all blanks
      {
          cout &lt;&lt;"\t-------------------------------"&lt;&lt;endl;
          cout &lt;&lt;"\t|";
          for (int y=0;y&lt;15;y++)
          {
  
              cout &lt;&lt; tem[x][y];
              cout&lt;&lt;"|";
          }
          cout &lt;&lt;"\n";
      }
      cout &lt;&lt;"\t-------------------------------"&lt;&lt;endl;
  }
  void dpinfo(printype mc)
  {
      cout &lt;&lt;"The unknown is:\t"&lt;&lt;mc.unknown15&lt;&lt;"\nThe String is:\t"&lt;&lt;mc.serial11_14&lt;&lt;"\n Time:\n\n Year: 20"&lt;&lt;mc.year8&lt;&lt;" month: "&lt;&lt;mc.month7&lt;&lt;"\n day: "&lt;&lt;mc.day6&lt;&lt;" hour: "&lt;&lt;mc.hour5&lt;&lt;"\n minute: "&lt;&lt;mc.minute2&lt;&lt;endl;
  }
  void spar(char tem[8][15])
  {
      int count=0;
      for (int x=0;x&lt;7;x++)
      {
          for (int y=0;y&lt;15;y++)
          {
              if(tem[x][y]=='*')
              {
                  count+=1;
              }
          }
          if(count%2==0)
          {
              tem[x][0]='*';
          }
      }
      count=0;
      for (int a=0;a&lt;7;a++)
      {
          for (int z=0;z&lt;7;z++)
          {
  
          }
      }
  }
  void ftarray(printype &amp;pt)
  {
      int tem=0;
      for (int x=1;x&lt;15;x++)
      {
          switch(x)
          {
              case 1:
              {
                  tem=pt.minute2;
                  break;
              }
              case 4:
              {
                  tem=pt.hour5;
                  break;
              }
              case 5:
              {
                  tem=pt.day6;
                  break;
              }
              case 6:
              {
                  tem=pt.month7;
                  break;
              }
              case 7:
              {
                  tem=pt.year8;
                  break;
              }
              case 9:
              {
                  for (int j = 1; j &lt; 8; j++)
                      {
                          pt.dots[j][x] = '*';
                      }
              }
              case 10:
              {
                  tem=atoi(pt.serial11_14.substr(6,2).c_str());
                  break;
              }
              case 11:
              {
                  tem=atoi(pt.serial11_14.substr(4,2).c_str());
                  break;
              }
              case 12:
              {
                  tem=atoi(pt.serial11_14.substr(2,2).c_str());
                  break;
              }
              case 13:
              {
                  tem=atoi(pt.serial11_14.substr(0,2).c_str());
                  break;
              }
              case 14:
              {
                  tem=pt.unknown15;
                  break;
              }
          }
          if(x==1||x==4||x==5||x==6||x==7||x==10||x==11||x==12||x==13||x==14)
          {
              if (tem&gt;=64)
              {
                  pt.dots[1][x]='*';
                  tem-=64;
              }
              if (tem&gt;=32)
              {
                  pt.dots[2][x]='*';
                  tem-=32;
              }
              if (tem&gt;=16)
              {
                  pt.dots[3][x]='*';
                  tem-=16;
              }
              if (tem&gt;=8)
              {
                  pt.dots[4][x]='*';
                  tem-=8;
              }
              if (tem&gt;=4)
              {
                  pt.dots[5][x]='*';
                  tem-=4;
              }
              if (tem&gt;=2)
              {
                  pt.dots[6][x]='*';
                  tem-=2;
              }
              if (tem&gt;=1)
              {
                  pt.dots[7][x]='*';
                  tem-=1;
  
              }
          }
      }
  }
  </code></pre>