Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The c++ program class called Time will have 3 integer data members named hrs, mi

ID: 3638438 • Letter: T

Question

The c++ program class called Time will have 3 integer data members named hrs, mins & secs which would be used to store hours, minutes and seconds. Member function will contain a constructor that supply’s default values “zero” for each data member, a display function that prints an object’s data values and lastly, an assignment operator that execute a member intelligent assignment between “2 Time objects”.Im getting errors=feedback using visual studio 201 c++ programming, am I missing something when i compilethe data??

#include <iostream>
using namespace std;

int main()
{

class Time
{
int hrs,mins,secs;
public:
Time(int Hrs=0,int Mins=0,int Secs=0;)
{
hrs=Hrs;
mins=Mins;
secs=Secs;
}
void display()
{
cout<<"hrs = "<<hrs<<endl;
cout<<"mins= "<<mins<<endl;
cout<<"secs= "<<secs<<endl;
}

Explanation / Answer

#include using namespace std; int main() { class Time{ //variable declarations //Functions }; int main(){ Time t; // t.functionName(parameters...); } class Time { int hrs,mins,secs; public: Time(){hrs=mins=secs=0;} void display() { cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote