title: c++ read .csv file, place data into variables and then into an object
body: <p>hi reached a point where im not sure how to proceed.
  the main objective of my program: </p>
  
  <p>1) read 5 values from a file(.csv)</p>
  
  <ul>
  <li><p>date (class with 3 variables - day,month, year)</p></li>
  <li><p>time (class with 2 variables - minute, hour)</p></li>
  <li><p>float wSpeed (under class weather)</p></li>
  <li><p>float temperature (under class weather)</p></li>
  <li><p>float solarRadiation (under class weather)    </p></li>
  </ul>
  
  <p>2) put into an object</p>
  
  <p>3) put it into a vector</p>
  
  <p>main </p>
  
  <pre><code>   int main()
  {
   string filename;
   ifstream input;
  
  Vector&lt;weather&gt; windlog; //have a vector called windlog
  
  cout &lt;&lt;"enter file name:" &lt;&lt;endl;
  cin &gt;&gt; filename;
  
  input.open(filename.c_str());
  input.ignore(500,'\n');
  
  string sDay, sMonth, sYear, sHH, sMM, wind, solar, temperature;
  date d1;
  time t1;
  weather w1;
  
  getline(input, sDay,'/'); //stop getting input at '/'
  getline(input, sMonth,'/');
  getline(input, sYear,' ');
  getline(input, sHH,':');
  getline(input, sMM,',');
  
  int day1 = atoi(sDay.c_str()); //convert string to int (atoi)
  int month1 = atoi(sMonth.c_str());
  int year1 = atoi(sYear.c_str());
  int hour1 = atoi(sHH.c_str());
  int min1 = atoi(sMM.c_str());
  
  d1.setDate(day1,month1,year1); //set date using converted string
  t1.setTime(min1, hour1); //set time using converted string
  
           // skip the first 9 columns of .csv file
      for(int i=0; i&lt;9; i++) 
       {
          input.ignore(50, ','); //ignore ','
       }
  
          //location now at wSpeed date of .csv file
      getline(input, wind,',');
      float wS1 = atof(wind.c_str()); // convert string to float
  
         //next location is the location solarRadiation
      getline(input, solar,',');
      float sR1= atof(solar.c_str()); // convert string to float
  
        //move 5 columns
       for(int i=0; i&lt; 5; i++)
       {
        input.ignore(50, ',');
       }
  
        //at location of temperature
       getline(input, temperature,'\n');
      float temperature1 = atof(temperature.c_str()); // convert string to 
                                                         float
  
      //when i print it out, it gives me the correct data
      /*
  cout &lt;&lt; d1; //date class that contains dd,mm,yy
  cout &lt;&lt; t1;//time class that contains hh, mm
  cout &lt;&lt; wS1 ;
  cout &lt;&lt; sR1;
  cout &lt;&lt; temperature1 &lt;&lt; endl;
      */
  
   //trying to put these data into an object file: weather
  
   //i tried doing something like this
  weather obj1(wS1, sR1, temperature1, d1, t1);
  cout &lt;&lt; objt1;//gives me weird values but when i cout each variable, it 
   works out fine
  </code></pre>
  
  <p>not going to write the whole date/time.h/cpp cause i think it'll take up too much space</p>
  
  <p>date.h</p>
  
  <pre><code>  public:
    setday, setmonth, setyear, setdate(day,month,year);
    getday,getmonth,getyear;
    private: day,month,year;
  </code></pre>
  
  <p>time.h</p>
  
  <pre><code>  public:
    setminute, sethour, settime(minute,hour);
    getminute,get hour;
    private: minute, hour;
  </code></pre>
  
  <p>weather class(where im having the problems)</p>
  
  <p>.H</p>
  
  <pre><code>  #ifndef H_WEATHER  
    #define  H_WEATHER
    #include &lt;iostream&gt;
    #include &lt;string&gt;
    #include "time.h"
    #include "date.h"
    using namespace std;
  
    class weather: public date, time
       {
       friend ostream&amp; operator &lt;&lt; (ostream&amp;, const weather&amp;);
       friend istream&amp; operator &gt;&gt; (istream&amp;, weather&amp;);
          public:
            weather();
            weather(float wSpeed, float solarRadiation, float temperature, 
            date d1, time t1);
  
            ~weather();
  
             void setWspeed(float wSpeed);
             void setSolarRadiation(float solarRadiation);
             void setTemperature(float temperature);
  
             float getWspeed() const ;
             float getSolarRadiation() const;
             float getTemperature() const;
             void setWeather(float wS, float sR, float t,date d1, time t1);
             date getDate();
             time getTime();
             date d1;//mm, hh
             time t1;//dd,mm,yy
          private:
             float wSpeed;
             float solarRadiation;
             float temperature;
             };
        #endif
  </code></pre>
  
  <p>.CPP</p>
  
  <pre><code>   #include &lt;iostream&gt;
     #include "weather.h"
     #include "date.h"
     #include "time.h"
  
      weather::weather()
      {
       wSpeed=0;
       solarRadiation=0;
       temperature = 0;
       }
  
       weather::weather(float wS, float sR, float t, date d1, time 
       t1):date(day,month,year), time(hours,minute)
        {
  
           wS = wS;
           sR = sR;
           t =t;
           d1.setDate(day,month, year);
           t1.setTime(hours,minute);
         }
         weather::~weather() {}
  
         void weather::setWeather(float wS, float sR, float t)
        {
          wSpeed =wS;
          solarRadiation=sR;
          temperature =t;
         }
        void weather::setWspeed(float wS)
         {
          wSpeed =wS;
         }
        void weather::setSolarRadiation(float sR)
        {
         solarRadiation=sR;
        }
  
        void weather::setTemperature(float t)
        {
         temperature = t;
         }
         void weather::setWeather(float wS,float sR, float t, date d1, time 
         t1)
         {
           wSpeed=wS;
           solarRadiation=sR;
           temperature = t;
         }
         float weather::getWspeed() const
         {
         return wSpeed;
         }
         float weather::getSolarRadiation() const
         {
          return solarRadiation;
         }
         float weather::getTemperature() const
          {
          return temperature;
          }
  
  
  
           ostream&amp; operator&lt;&lt; (ostream&amp; osObject, const weather&amp; weather1)
         {
  
          osObject &lt;&lt; weather1.wSpeed &lt;&lt;"  " &lt;&lt; weather1.solarRadiation &lt;&lt;""
          &lt;&lt; weather1.temperature &lt;&lt;  weather1.d1 &lt;&lt; weather1.t1 ;
          return osObject;
         }
         istream&amp; operator &gt;&gt; (istream&amp; isObject, weather&amp; weather1)
         {
         isObject &gt;&gt; weather1.wSpeed&gt;&gt; weather1.solarRadiation &gt;&gt; 
         weather1.temperature &gt;&gt;  weather1.d1 &gt;&gt; weather1.t1;
         return isObject;
          }
  </code></pre>
  
  <p>how do i put the values into an object? is it correct i have to use inheritance so i can overload the weather constructor so it can take a date and time class?</p>