Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Trouble figuring out where to put the function header/prototype

$
0
0
I have everything else I am having trouble figuring out where to put the function prototype for this program. Thanks so much for your help. I really appreciate it. Below is the code
#include <cstdlib>
#include <iostream>
using namespace std;
void setTime(int h , int m);
class Time 
{
      friend ostream & operator <<(ostream &, Time &);
public:
       Time();
       Time (int,int);
       void setTime(int,int);       
private:
        int hours;
        int minutes;
};
class date
{
      friend ostream & operator <<(ostream &, date &);
public:
       date();
       date(int,int,int,int ,int);
private:
        int month;
        int day;
        int year;
        Time tobj;
};  
date::date()
{}
date :: date (int mm, int dd, int yyyy, Time &t)
{
     tobj = t;
     month = mm;
     day = dd;
     year = yyyy;
     tobj.setTime(int h, int m);
}
ostream & operator <<(ostream &, time &)
{
        out << "Time : " << obj.tobj << " Date : " <<obj.month << "/" << obj.day << "/" << obj.year;          
ostream & operator <<(ostream &out, Time &obj)
{
               out<<obj.hours<< " : " << obj.minutes;
               return out;
}
Time :: Time ()
{}
Time: Time (int h, int m)
{
      hours = h;
      minutes = m;
}    
int main(int argc, char *argv[])
{
    Time t(19,30);
    Date (12,4,2012,20,40);
    cout<<"Class begins at : " << t << endl;
    cout<<d<<endl;
    return 0;
   
}
     system("PAUSE");
    return EXIT_SUCCESS;
}


Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>