test
This commit is contained in:
parent
37776af5db
commit
ab03d5f10c
4045 changed files with 286212 additions and 3 deletions
75
.config/Code/User/History/1613c77b/004r.cpp
Normal file
75
.config/Code/User/History/1613c77b/004r.cpp
Normal file
|
@ -0,0 +1,75 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Time{
|
||||
// You will need three integer data members to store the hours, minutes, and seconds.
|
||||
int hours;
|
||||
int minutes;
|
||||
int seconds;
|
||||
public:
|
||||
Time(int hours = 0, int minutes = 0, int seconds = 0) : hours(hours), minutes(minutes), seconds(seconds){}
|
||||
Time(const Time& copy){
|
||||
*this = copy;
|
||||
}
|
||||
// Binary Operators
|
||||
// Arithmetic Operators
|
||||
Time operator+(const Time& val) const{
|
||||
Time result;
|
||||
result.seconds = this->seconds + val.seconds;
|
||||
if(result.seconds>=60){
|
||||
result.seconds -= 60;
|
||||
result.minutes++;
|
||||
}
|
||||
result.minutes += this->minutes + val.minutes;
|
||||
if(result.minutes>=60){
|
||||
result.minutes -= 60;
|
||||
result.hours++;
|
||||
}
|
||||
result.hours += this->hours + val.hours;
|
||||
return result;
|
||||
}
|
||||
Time operator-(const Time& val) const{
|
||||
|
||||
// 5m 40s - 2m 50s
|
||||
Time result;
|
||||
result.hours = this->hours - val.hours;
|
||||
result.seconds = this->seconds - val.seconds;
|
||||
if(result.seconds<0){
|
||||
|
||||
}
|
||||
}
|
||||
// Compound Assignment Operators
|
||||
Time operator+=(const Time& rhs){
|
||||
return *this + rhs;
|
||||
}
|
||||
Time operator-=(const Time& rhs){
|
||||
return *this - rhs;
|
||||
}
|
||||
// Logical Operators
|
||||
bool operator==(const Time& val) const{
|
||||
return this->seconds == val.seconds && this->minutes == val.minutes && this->hours == val.hours;
|
||||
}
|
||||
bool operator!=(const Time& val) const{
|
||||
return !(*this == val);
|
||||
}
|
||||
bool operator<(const Time& val) const;
|
||||
bool operator<=(const Time& val) const;
|
||||
bool operator>(const Time& val) const;
|
||||
bool operator>=(const Time& val) const;
|
||||
// Additional Functions
|
||||
Time elapsedTime() const; // Calculate elapsed time
|
||||
~Time(){} // destructor
|
||||
friend std::ostream& operator<<(std::ostream& output, const Time& val); // outputs the Time
|
||||
friend std::istream& operator>>(std::istream& input, Time& val); // inputs the Time
|
||||
};
|
||||
ostream& operator<<(std::ostream& output, const Time& val){
|
||||
output<<"Hours "<<val.hours<<" Minutes "<<val.minutes<<" Seconds "<<val.seconds<<endl;
|
||||
}
|
||||
istream& operator>>(std::istream& input, Time& val){
|
||||
cout<<"Enter Hours: ";
|
||||
input>>val.hours;
|
||||
cout<<"Enter Minutes: ";
|
||||
input>>val.minutes;
|
||||
cout<<"Enter Seconds: ";
|
||||
input>>val.seconds;
|
||||
}
|
41
.config/Code/User/History/1613c77b/0dTT.cpp
Normal file
41
.config/Code/User/History/1613c77b/0dTT.cpp
Normal file
|
@ -0,0 +1,41 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Time{
|
||||
// You will need three integer data members to store the hours, minutes, and seconds.
|
||||
int hours;
|
||||
int minutes;
|
||||
int seconds;
|
||||
public:
|
||||
Time(int hours = 0, int minutes = 0, int seconds = 0) : hours(hours), minutes(minutes), seconds(seconds){}
|
||||
Time(const Time& copy){
|
||||
*this = copy;
|
||||
}
|
||||
// Binary Operators
|
||||
// Arithmetic Operators
|
||||
Time operator+(const Time& val) const{
|
||||
Time result;
|
||||
result.seconds = this->seconds + val.seconds;
|
||||
if(result.seconds>=60){
|
||||
result.seconds -= 60;
|
||||
result.minutes++;
|
||||
}
|
||||
result.minutes += this->minutes + val.minutes;
|
||||
}
|
||||
Time operator-(const Time& val) const;
|
||||
// Compound Assignment Operators
|
||||
Time& operator+=(const Time& rhs);
|
||||
Time& operator-=(const Time& rhs);
|
||||
// Logical Operators
|
||||
bool operator==(const Time& val) const;
|
||||
bool operator!=(const Time& val) const;
|
||||
bool operator<(const Time& val) const;
|
||||
bool operator<=(const Time& val) const;
|
||||
bool operator>(const Time& val) const;
|
||||
bool operator>=(const Time& val) const;
|
||||
// Additional Functions
|
||||
Time elapsedTime() const; // Calculate elapsed time
|
||||
~Time(); // destructor
|
||||
friend std::ostream& operator<<(std::ostream& output, const Time& val); // outputs the Time
|
||||
friend std::istream& operator>>(std::istream& input, Time& val); // inputs the Time
|
||||
};
|
99
.config/Code/User/History/1613c77b/2Bsh.cpp
Normal file
99
.config/Code/User/History/1613c77b/2Bsh.cpp
Normal file
|
@ -0,0 +1,99 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Time{
|
||||
// You will need three integer data members to store the hours, minutes, and seconds.
|
||||
int hours;
|
||||
int minutes;
|
||||
int seconds;
|
||||
public:
|
||||
Time(int hours = 0, int minutes = 0, int seconds = 0) : hours(hours), minutes(minutes), seconds(seconds){}
|
||||
Time(const Time& copy){
|
||||
*this = copy;
|
||||
}
|
||||
// Binary Operators
|
||||
// Arithmetic Operators
|
||||
Time operator+(const Time& val) const{
|
||||
Time result;
|
||||
result.seconds = this->seconds + val.seconds;
|
||||
if(result.seconds>=60){
|
||||
result.seconds -= 60;
|
||||
result.minutes++;
|
||||
}
|
||||
result.minutes += this->minutes + val.minutes;
|
||||
if(result.minutes>=60){
|
||||
result.minutes -= 60;
|
||||
result.hours++;
|
||||
}
|
||||
result.hours += this->hours + val.hours;
|
||||
return result;
|
||||
}
|
||||
Time operator-(const Time& val) const{
|
||||
Time result;
|
||||
result.hours = this->hours - val.hours;
|
||||
if(result.hours<0) result.hours *= -1;
|
||||
result.minutes = this->minutes - val.minutes;
|
||||
if(result.minutes<0){
|
||||
result.hours--;
|
||||
result.minutes += 60;
|
||||
}
|
||||
result.seconds = this->seconds - val.seconds;
|
||||
if(result.seconds<0){
|
||||
result.minutes--;
|
||||
result.seconds += 60;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
// Compound Assignment Operators
|
||||
Time operator+=(const Time& rhs){
|
||||
return *this + rhs;
|
||||
}
|
||||
Time operator-=(const Time& rhs){
|
||||
return *this - rhs;
|
||||
}
|
||||
// Logical Operators
|
||||
bool operator==(const Time& val) const{
|
||||
return this->seconds == val.seconds && this->minutes == val.minutes && this->hours == val.hours;
|
||||
}
|
||||
bool operator!=(const Time& val) const{
|
||||
return !(*this == val);
|
||||
}
|
||||
bool operator<(const Time& val) const{
|
||||
if(this->hours<val.hours) return true;
|
||||
else if(this->hours>val.hours) return false;
|
||||
else if(this->minutes<val.minutes) return true;
|
||||
else if(this->minutes>val.minutes) return false;
|
||||
else return this->seconds<val.seconds;
|
||||
}
|
||||
bool operator<=(const Time& val) const{
|
||||
if(this->hours<val.hours) return true;
|
||||
else if(this->hours>val.hours) return false;
|
||||
else if(this->minutes<val.minutes) return true;
|
||||
else if(this->minutes>val.minutes) return false;
|
||||
else return this->seconds<val.seconds;
|
||||
}
|
||||
bool operator>(const Time& val) const{
|
||||
if(this->hours>val.hours) return true;
|
||||
else if(this->hours<val.hours) return false;
|
||||
else if(this->minutes>val.minutes) return true;
|
||||
else if(this->minutes<val.minutes) return false;
|
||||
else return this->seconds>val.seconds;
|
||||
}
|
||||
bool operator>=(const Time& val) const;
|
||||
// Additional Functions
|
||||
Time elapsedTime() const; // Calculate elapsed time
|
||||
~Time(){} // destructor
|
||||
friend std::ostream& operator<<(std::ostream& output, const Time& val); // outputs the Time
|
||||
friend std::istream& operator>>(std::istream& input, Time& val); // inputs the Time
|
||||
};
|
||||
ostream& operator<<(std::ostream& output, const Time& val){
|
||||
output<<"Hours "<<val.hours<<" Minutes "<<val.minutes<<" Seconds "<<val.seconds<<endl;
|
||||
}
|
||||
istream& operator>>(std::istream& input, Time& val){
|
||||
cout<<"Enter Hours: ";
|
||||
input>>val.hours;
|
||||
cout<<"Enter Minutes: ";
|
||||
input>>val.minutes;
|
||||
cout<<"Enter Seconds: ";
|
||||
input>>val.seconds;
|
||||
}
|
50
.config/Code/User/History/1613c77b/3YfV.cpp
Normal file
50
.config/Code/User/History/1613c77b/3YfV.cpp
Normal file
|
@ -0,0 +1,50 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Time{
|
||||
// You will need three integer data members to store the hours, minutes, and seconds.
|
||||
int hours;
|
||||
int minutes;
|
||||
int seconds;
|
||||
public:
|
||||
Time(int hours = 0, int minutes = 0, int seconds = 0) : hours(hours), minutes(minutes), seconds(seconds){}
|
||||
Time(const Time& copy){
|
||||
*this = copy;
|
||||
}
|
||||
// Binary Operators
|
||||
// Arithmetic Operators
|
||||
Time operator+(const Time& val) const{
|
||||
Time result;
|
||||
result.seconds = this->seconds + val.seconds;
|
||||
if(result.seconds>=60){
|
||||
result.seconds -= 60;
|
||||
result.minutes++;
|
||||
}
|
||||
result.minutes += this->minutes + val.minutes;
|
||||
if(result.minutes>=60){
|
||||
result.minutes -= 60;
|
||||
result.hours++;
|
||||
}
|
||||
result.hours += this->hours + val.hours;
|
||||
}
|
||||
Time operator-(const Time& val) const{
|
||||
|
||||
}
|
||||
// Compound Assignment Operators
|
||||
Time& operator+=(const Time& rhs){
|
||||
return *this + rhs;
|
||||
}
|
||||
Time& operator-=(const Time& rhs);
|
||||
// Logical Operators
|
||||
bool operator==(const Time& val) const;
|
||||
bool operator!=(const Time& val) const;
|
||||
bool operator<(const Time& val) const;
|
||||
bool operator<=(const Time& val) const;
|
||||
bool operator>(const Time& val) const;
|
||||
bool operator>=(const Time& val) const;
|
||||
// Additional Functions
|
||||
Time elapsedTime() const; // Calculate elapsed time
|
||||
~Time(); // destructor
|
||||
friend std::ostream& operator<<(std::ostream& output, const Time& val); // outputs the Time
|
||||
friend std::istream& operator>>(std::istream& input, Time& val); // inputs the Time
|
||||
};
|
50
.config/Code/User/History/1613c77b/4ryE.cpp
Normal file
50
.config/Code/User/History/1613c77b/4ryE.cpp
Normal file
|
@ -0,0 +1,50 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Time{
|
||||
// You will need three integer data members to store the hours, minutes, and seconds.
|
||||
int hours;
|
||||
int minutes;
|
||||
int seconds;
|
||||
public:
|
||||
Time(int hours = 0, int minutes = 0, int seconds = 0) : hours(hours), minutes(minutes), seconds(seconds){}
|
||||
Time(const Time& copy){
|
||||
*this = copy;
|
||||
}
|
||||
// Binary Operators
|
||||
// Arithmetic Operators
|
||||
Time operator+(Time& val) {
|
||||
Time result;
|
||||
result.seconds = this->seconds + val.seconds;
|
||||
if(result.seconds>=60){
|
||||
result.seconds -= 60;
|
||||
result.minutes++;
|
||||
}
|
||||
result.minutes += this->minutes + val.minutes;
|
||||
if(result.minutes>=60){
|
||||
result.minutes -= 60;
|
||||
result.hours++;
|
||||
}
|
||||
result.hours += this->hours + val.hours;
|
||||
}
|
||||
Time operator-(const Time& val) const{
|
||||
|
||||
}
|
||||
// Compound Assignment Operators
|
||||
Time& operator+=(const Time& rhs){
|
||||
return rhs + *this;
|
||||
}
|
||||
Time& operator-=(const Time& rhs);
|
||||
// Logical Operators
|
||||
bool operator==(const Time& val) const;
|
||||
bool operator!=(const Time& val) const;
|
||||
bool operator<(const Time& val) const;
|
||||
bool operator<=(const Time& val) const;
|
||||
bool operator>(const Time& val) const;
|
||||
bool operator>=(const Time& val) const;
|
||||
// Additional Functions
|
||||
Time elapsedTime() const; // Calculate elapsed time
|
||||
~Time(); // destructor
|
||||
friend std::ostream& operator<<(std::ostream& output, const Time& val); // outputs the Time
|
||||
friend std::istream& operator>>(std::istream& input, Time& val); // inputs the Time
|
||||
};
|
63
.config/Code/User/History/1613c77b/7jWH.cpp
Normal file
63
.config/Code/User/History/1613c77b/7jWH.cpp
Normal file
|
@ -0,0 +1,63 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Time{
|
||||
// You will need three integer data members to store the hours, minutes, and seconds.
|
||||
int hours;
|
||||
int minutes;
|
||||
int seconds;
|
||||
public:
|
||||
Time(int hours = 0, int minutes = 0, int seconds = 0) : hours(hours), minutes(minutes), seconds(seconds){}
|
||||
Time(const Time& copy){
|
||||
*this = copy;
|
||||
}
|
||||
// Binary Operators
|
||||
// Arithmetic Operators
|
||||
Time operator+(const Time& val) const{
|
||||
Time result;
|
||||
result.seconds = this->seconds + val.seconds;
|
||||
if(result.seconds>=60){
|
||||
result.seconds -= 60;
|
||||
result.minutes++;
|
||||
}
|
||||
result.minutes += this->minutes + val.minutes;
|
||||
if(result.minutes>=60){
|
||||
result.minutes -= 60;
|
||||
result.hours++;
|
||||
}
|
||||
result.hours += this->hours + val.hours;
|
||||
return result;
|
||||
}
|
||||
Time operator-(const Time& val) const{
|
||||
|
||||
}
|
||||
// Compound Assignment Operators
|
||||
Time operator+=(const Time& rhs){
|
||||
return *this + rhs;
|
||||
}
|
||||
Time operator-=(const Time& rhs){
|
||||
return *this - rhs;
|
||||
}
|
||||
// Logical Operators
|
||||
bool operator==(const Time& val) const{
|
||||
return this->seconds == val.seconds && this->minutes == val.minutes && this->hours == val.hours;
|
||||
}
|
||||
bool operator!=(const Time& val) const{
|
||||
return !(*this == val);
|
||||
}
|
||||
bool operator<(const Time& val) const;
|
||||
bool operator<=(const Time& val) const;
|
||||
bool operator>(const Time& val) const;
|
||||
bool operator>=(const Time& val) const;
|
||||
// Additional Functions
|
||||
Time elapsedTime() const; // Calculate elapsed time
|
||||
~Time(){} // destructor
|
||||
friend std::ostream& operator<<(std::ostream& output, const Time& val); // outputs the Time
|
||||
friend std::istream& operator>>(std::istream& input, Time& val); // inputs the Time
|
||||
};
|
||||
ostream& operator<<(std::ostream& output, const Time& val){
|
||||
output<<"Hours "<<val.hours<<" Minutes "<<val.minutes<<" Seconds "<<val.seconds<<endl;
|
||||
}
|
||||
istream& operator>>(std::istream& input, Time& val){
|
||||
|
||||
}
|
76
.config/Code/User/History/1613c77b/91q4.cpp
Normal file
76
.config/Code/User/History/1613c77b/91q4.cpp
Normal file
|
@ -0,0 +1,76 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Time{
|
||||
// You will need three integer data members to store the hours, minutes, and seconds.
|
||||
int hours;
|
||||
int minutes;
|
||||
int seconds;
|
||||
public:
|
||||
Time(int hours = 0, int minutes = 0, int seconds = 0) : hours(hours), minutes(minutes), seconds(seconds){}
|
||||
Time(const Time& copy){
|
||||
*this = copy;
|
||||
}
|
||||
// Binary Operators
|
||||
// Arithmetic Operators
|
||||
Time operator+(const Time& val) const{
|
||||
Time result;
|
||||
result.seconds = this->seconds + val.seconds;
|
||||
if(result.seconds>=60){
|
||||
result.seconds -= 60;
|
||||
result.minutes++;
|
||||
}
|
||||
result.minutes += this->minutes + val.minutes;
|
||||
if(result.minutes>=60){
|
||||
result.minutes -= 60;
|
||||
result.hours++;
|
||||
}
|
||||
result.hours += this->hours + val.hours;
|
||||
return result;
|
||||
}
|
||||
Time operator-(const Time& val) const{
|
||||
|
||||
// 2h 5m 40s - 1h 2m 50s
|
||||
Time result;
|
||||
result.hours = this->hours - val.hours;
|
||||
if(result.hours<0) result.hours *= -1;
|
||||
result.seconds = this->seconds - val.seconds;
|
||||
if(result.seconds<0){
|
||||
|
||||
}
|
||||
}
|
||||
// Compound Assignment Operators
|
||||
Time operator+=(const Time& rhs){
|
||||
return *this + rhs;
|
||||
}
|
||||
Time operator-=(const Time& rhs){
|
||||
return *this - rhs;
|
||||
}
|
||||
// Logical Operators
|
||||
bool operator==(const Time& val) const{
|
||||
return this->seconds == val.seconds && this->minutes == val.minutes && this->hours == val.hours;
|
||||
}
|
||||
bool operator!=(const Time& val) const{
|
||||
return !(*this == val);
|
||||
}
|
||||
bool operator<(const Time& val) const;
|
||||
bool operator<=(const Time& val) const;
|
||||
bool operator>(const Time& val) const;
|
||||
bool operator>=(const Time& val) const;
|
||||
// Additional Functions
|
||||
Time elapsedTime() const; // Calculate elapsed time
|
||||
~Time(){} // destructor
|
||||
friend std::ostream& operator<<(std::ostream& output, const Time& val); // outputs the Time
|
||||
friend std::istream& operator>>(std::istream& input, Time& val); // inputs the Time
|
||||
};
|
||||
ostream& operator<<(std::ostream& output, const Time& val){
|
||||
output<<"Hours "<<val.hours<<" Minutes "<<val.minutes<<" Seconds "<<val.seconds<<endl;
|
||||
}
|
||||
istream& operator>>(std::istream& input, Time& val){
|
||||
cout<<"Enter Hours: ";
|
||||
input>>val.hours;
|
||||
cout<<"Enter Minutes: ";
|
||||
input>>val.minutes;
|
||||
cout<<"Enter Seconds: ";
|
||||
input>>val.seconds;
|
||||
}
|
53
.config/Code/User/History/1613c77b/B1ey.cpp
Normal file
53
.config/Code/User/History/1613c77b/B1ey.cpp
Normal file
|
@ -0,0 +1,53 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Time{
|
||||
// You will need three integer data members to store the hours, minutes, and seconds.
|
||||
int hours;
|
||||
int minutes;
|
||||
int seconds;
|
||||
public:
|
||||
Time(int hours = 0, int minutes = 0, int seconds = 0) : hours(hours), minutes(minutes), seconds(seconds){}
|
||||
Time(const Time& copy){
|
||||
*this = copy;
|
||||
}
|
||||
// Binary Operators
|
||||
// Arithmetic Operators
|
||||
Time operator+(const Time& val) const{
|
||||
Time result;
|
||||
result.seconds = this->seconds + val.seconds;
|
||||
if(result.seconds>=60){
|
||||
result.seconds -= 60;
|
||||
result.minutes++;
|
||||
}
|
||||
result.minutes += this->minutes + val.minutes;
|
||||
if(result.minutes>=60){
|
||||
result.minutes -= 60;
|
||||
result.hours++;
|
||||
}
|
||||
result.hours += this->hours + val.hours;
|
||||
return result;
|
||||
}
|
||||
Time operator-(const Time& val) const{
|
||||
|
||||
}
|
||||
// Compound Assignment Operators
|
||||
Time operator+=(const Time& rhs){
|
||||
return *this + rhs;
|
||||
}
|
||||
Time operator-=(const Time& rhs){
|
||||
return *this - rhs;
|
||||
}
|
||||
// Logical Operators
|
||||
bool operator==(const Time& val) const;
|
||||
bool operator!=(const Time& val) const;
|
||||
bool operator<(const Time& val) const;
|
||||
bool operator<=(const Time& val) const;
|
||||
bool operator>(const Time& val) const;
|
||||
bool operator>=(const Time& val) const;
|
||||
// Additional Functions
|
||||
Time elapsedTime() const; // Calculate elapsed time
|
||||
~Time(); // destructor
|
||||
friend std::ostream& operator<<(std::ostream& output, const Time& val); // outputs the Time
|
||||
friend std::istream& operator>>(std::istream& input, Time& val); // inputs the Time
|
||||
};
|
50
.config/Code/User/History/1613c77b/BDfR.cpp
Normal file
50
.config/Code/User/History/1613c77b/BDfR.cpp
Normal file
|
@ -0,0 +1,50 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Time{
|
||||
// You will need three integer data members to store the hours, minutes, and seconds.
|
||||
int hours;
|
||||
int minutes;
|
||||
int seconds;
|
||||
public:
|
||||
Time(int hours = 0, int minutes = 0, int seconds = 0) : hours(hours), minutes(minutes), seconds(seconds){}
|
||||
Time(const Time& copy){
|
||||
*this = copy;
|
||||
}
|
||||
// Binary Operators
|
||||
// Arithmetic Operators
|
||||
Time operator+(const Time& val) const{
|
||||
Time result;
|
||||
result.seconds = this->seconds + val.seconds;
|
||||
if(result.seconds>=60){
|
||||
result.seconds -= 60;
|
||||
result.minutes++;
|
||||
}
|
||||
result.minutes += this->minutes + val.minutes;
|
||||
if(result.minutes>=60){
|
||||
result.minutes -= 60;
|
||||
result.hours++;
|
||||
}
|
||||
result.hours += this->hours + val.hours;
|
||||
}
|
||||
Time operator-(const Time& val) const{
|
||||
|
||||
}
|
||||
// Compound Assignment Operators
|
||||
Time& operator+=(const Time& rhs){
|
||||
return rhs + *this;
|
||||
}
|
||||
Time& operator-=(const Time& rhs);
|
||||
// Logical Operators
|
||||
bool operator==(const Time& val) const;
|
||||
bool operator!=(const Time& val) const;
|
||||
bool operator<(const Time& val) const;
|
||||
bool operator<=(const Time& val) const;
|
||||
bool operator>(const Time& val) const;
|
||||
bool operator>=(const Time& val) const;
|
||||
// Additional Functions
|
||||
Time elapsedTime() const; // Calculate elapsed time
|
||||
~Time(); // destructor
|
||||
friend std::ostream& operator<<(std::ostream& output, const Time& val); // outputs the Time
|
||||
friend std::istream& operator>>(std::istream& input, Time& val); // inputs the Time
|
||||
};
|
81
.config/Code/User/History/1613c77b/C00E.cpp
Normal file
81
.config/Code/User/History/1613c77b/C00E.cpp
Normal file
|
@ -0,0 +1,81 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Time{
|
||||
// You will need three integer data members to store the hours, minutes, and seconds.
|
||||
int hours;
|
||||
int minutes;
|
||||
int seconds;
|
||||
public:
|
||||
Time(int hours = 0, int minutes = 0, int seconds = 0) : hours(hours), minutes(minutes), seconds(seconds){}
|
||||
Time(const Time& copy){
|
||||
*this = copy;
|
||||
}
|
||||
// Binary Operators
|
||||
// Arithmetic Operators
|
||||
Time operator+(const Time& val) const{
|
||||
Time result;
|
||||
result.seconds = this->seconds + val.seconds;
|
||||
if(result.seconds>=60){
|
||||
result.seconds -= 60;
|
||||
result.minutes++;
|
||||
}
|
||||
result.minutes += this->minutes + val.minutes;
|
||||
if(result.minutes>=60){
|
||||
result.minutes -= 60;
|
||||
result.hours++;
|
||||
}
|
||||
result.hours += this->hours + val.hours;
|
||||
return result;
|
||||
}
|
||||
Time operator-(const Time& val) const{
|
||||
Time result;
|
||||
result.hours = this->hours - val.hours;
|
||||
if(result.hours<0) result.hours *= -1;
|
||||
result.minutes = this->minutes - val.minutes;
|
||||
if(result.minutes<0){
|
||||
result.hours--;
|
||||
result.minutes += 60;
|
||||
}
|
||||
result.seconds = this->seconds - val.seconds;
|
||||
if(result.seconds<0){
|
||||
result.minutes--;
|
||||
result.seconds += 60;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
// Compound Assignment Operators
|
||||
Time operator+=(const Time& rhs){
|
||||
return *this + rhs;
|
||||
}
|
||||
Time operator-=(const Time& rhs){
|
||||
return *this - rhs;
|
||||
}
|
||||
// Logical Operators
|
||||
bool operator==(const Time& val) const{
|
||||
return this->seconds == val.seconds && this->minutes == val.minutes && this->hours == val.hours;
|
||||
}
|
||||
bool operator!=(const Time& val) const{
|
||||
return !(*this == val);
|
||||
}
|
||||
bool operator<(const Time& val) const;
|
||||
bool operator<=(const Time& val) const;
|
||||
bool operator>(const Time& val) const;
|
||||
bool operator>=(const Time& val) const;
|
||||
// Additional Functions
|
||||
Time elapsedTime() const; // Calculate elapsed time
|
||||
~Time(){} // destructor
|
||||
friend std::ostream& operator<<(std::ostream& output, const Time& val); // outputs the Time
|
||||
friend std::istream& operator>>(std::istream& input, Time& val); // inputs the Time
|
||||
};
|
||||
ostream& operator<<(std::ostream& output, const Time& val){
|
||||
output<<"Hours "<<val.hours<<" Minutes "<<val.minutes<<" Seconds "<<val.seconds<<endl;
|
||||
}
|
||||
istream& operator>>(std::istream& input, Time& val){
|
||||
cout<<"Enter Hours: ";
|
||||
input>>val.hours;
|
||||
cout<<"Enter Minutes: ";
|
||||
input>>val.minutes;
|
||||
cout<<"Enter Seconds: ";
|
||||
input>>val.seconds;
|
||||
}
|
114
.config/Code/User/History/1613c77b/Cbc3.cpp
Normal file
114
.config/Code/User/History/1613c77b/Cbc3.cpp
Normal file
|
@ -0,0 +1,114 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Time{
|
||||
// You will need three integer data members to store the hours, minutes, and seconds.
|
||||
int hours;
|
||||
int minutes;
|
||||
int seconds;
|
||||
public:
|
||||
Time(int hours=0, int minutes=0, int seconds=0) : hours(hours), minutes(minutes), seconds(seconds){
|
||||
if(this->seconds>=60){
|
||||
this->minutes += this->seconds%60;
|
||||
this->seconds /= 60;
|
||||
}
|
||||
if(this->minutes>=60){
|
||||
this->hours += this->minutes%60;
|
||||
this->minutes /= 60;
|
||||
}
|
||||
}
|
||||
Time(const Time& copy){
|
||||
*this = copy;
|
||||
}
|
||||
// Binary Operators
|
||||
// Arithmetic Operators
|
||||
Time operator+(const Time& val) const{
|
||||
Time result;
|
||||
result.seconds = this->seconds + val.seconds;
|
||||
if(result.seconds>=60){
|
||||
result.seconds -= 60;
|
||||
result.minutes++;
|
||||
}
|
||||
result.minutes += this->minutes + val.minutes;
|
||||
if(result.minutes>=60){
|
||||
result.minutes -= 60;
|
||||
result.hours++;
|
||||
}
|
||||
result.hours += this->hours + val.hours;
|
||||
return result;
|
||||
}
|
||||
Time operator-(const Time& val) const{
|
||||
Time result;
|
||||
result.hours = this->hours - val.hours;
|
||||
if(result.hours<0) result.hours *= -1;
|
||||
result.minutes = this->minutes - val.minutes;
|
||||
if(result.minutes<0){
|
||||
result.hours--;
|
||||
result.minutes += 60;
|
||||
}
|
||||
result.seconds = this->seconds - val.seconds;
|
||||
if(result.seconds<0){
|
||||
result.minutes--;
|
||||
result.seconds += 60;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
// Compound Assignment Operators
|
||||
Time operator+=(const Time& rhs){
|
||||
return *this + rhs;
|
||||
}
|
||||
Time operator-=(const Time& rhs){
|
||||
return *this - rhs;
|
||||
}
|
||||
// Logical Operators
|
||||
bool operator==(const Time& val) const{
|
||||
return this->seconds == val.seconds && this->minutes == val.minutes && this->hours == val.hours;
|
||||
}
|
||||
bool operator!=(const Time& val) const{
|
||||
return !(*this == val);
|
||||
}
|
||||
bool operator<(const Time& val) const{
|
||||
if(this->hours<val.hours) return true;
|
||||
else if(this->hours>val.hours) return false;
|
||||
else if(this->minutes<val.minutes) return true;
|
||||
else if(this->minutes>val.minutes) return false;
|
||||
else return this->seconds<val.seconds;
|
||||
}
|
||||
bool operator<=(const Time& val) const{
|
||||
if(this->hours<val.hours) return true;
|
||||
else if(this->hours>val.hours) return false;
|
||||
else if(this->minutes<val.minutes) return true;
|
||||
else if(this->minutes>val.minutes) return false;
|
||||
else return this->seconds<=val.seconds;
|
||||
}
|
||||
bool operator>(const Time& val) const{
|
||||
if(this->hours>val.hours) return true;
|
||||
else if(this->hours<val.hours) return false;
|
||||
else if(this->minutes>val.minutes) return true;
|
||||
else if(this->minutes<val.minutes) return false;
|
||||
else return this->seconds>val.seconds;
|
||||
}
|
||||
bool operator>=(const Time& val) const{
|
||||
if(this->hours>val.hours) return true;
|
||||
else if(this->hours<val.hours) return false;
|
||||
else if(this->minutes>val.minutes) return true;
|
||||
else if(this->minutes<val.minutes) return false;
|
||||
else return this->seconds>=val.seconds;
|
||||
}
|
||||
// Additional Functions
|
||||
Time elapsedTime() const{} // Calculate elapsed time
|
||||
~Time(){} // destructor
|
||||
friend std::ostream& operator<<(std::ostream& output, const Time& val); // outputs the Time
|
||||
friend std::istream& operator>>(std::istream& input, Time& val); // inputs the Time
|
||||
};
|
||||
ostream& operator<<(std::ostream& output, const Time& val){
|
||||
output<<"Hours "<<val.hours<<" Minutes "<<val.minutes<<" Seconds "<<val.seconds<<endl;
|
||||
}
|
||||
istream& operator>>(std::istream& input, Time& val){
|
||||
cout<<"Enter Hours: ";
|
||||
input>>val.hours;
|
||||
cout<<"Enter Minutes: ";
|
||||
input>>val.minutes;
|
||||
cout<<"Enter Seconds: ";
|
||||
input>>val.seconds;
|
||||
}
|
57
.config/Code/User/History/1613c77b/CpTI.cpp
Normal file
57
.config/Code/User/History/1613c77b/CpTI.cpp
Normal file
|
@ -0,0 +1,57 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Time{
|
||||
// You will need three integer data members to store the hours, minutes, and seconds.
|
||||
int hours;
|
||||
int minutes;
|
||||
int seconds;
|
||||
public:
|
||||
Time(int hours = 0, int minutes = 0, int seconds = 0) : hours(hours), minutes(minutes), seconds(seconds){}
|
||||
Time(const Time& copy){
|
||||
*this = copy;
|
||||
}
|
||||
// Binary Operators
|
||||
// Arithmetic Operators
|
||||
Time operator+(const Time& val) const{
|
||||
Time result;
|
||||
result.seconds = this->seconds + val.seconds;
|
||||
if(result.seconds>=60){
|
||||
result.seconds -= 60;
|
||||
result.minutes++;
|
||||
}
|
||||
result.minutes += this->minutes + val.minutes;
|
||||
if(result.minutes>=60){
|
||||
result.minutes -= 60;
|
||||
result.hours++;
|
||||
}
|
||||
result.hours += this->hours + val.hours;
|
||||
return result;
|
||||
}
|
||||
Time operator-(const Time& val) const{
|
||||
|
||||
}
|
||||
// Compound Assignment Operators
|
||||
Time operator+=(const Time& rhs){
|
||||
return *this + rhs;
|
||||
}
|
||||
Time operator-=(const Time& rhs){
|
||||
return *this - rhs;
|
||||
}
|
||||
// Logical Operators
|
||||
bool operator==(const Time& val) const{
|
||||
return this->seconds == val.seconds && this->minutes == val.minutes && this->hours == val.hours;
|
||||
}
|
||||
bool operator!=(const Time& val) const{
|
||||
return !(*this == val);
|
||||
}
|
||||
bool operator<(const Time& val) const;
|
||||
bool operator<=(const Time& val) const;
|
||||
bool operator>(const Time& val) const;
|
||||
bool operator>=(const Time& val) const;
|
||||
// Additional Functions
|
||||
Time elapsedTime() const; // Calculate elapsed time
|
||||
~Time(){} // destructor
|
||||
friend std::ostream& operator<<(std::ostream& output, const Time& val); // outputs the Time
|
||||
friend std::istream& operator>>(std::istream& input, Time& val); // inputs the Time
|
||||
};
|
87
.config/Code/User/History/1613c77b/D9zf.cpp
Normal file
87
.config/Code/User/History/1613c77b/D9zf.cpp
Normal file
|
@ -0,0 +1,87 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Time{
|
||||
// You will need three integer data members to store the hours, minutes, and seconds.
|
||||
int hours;
|
||||
int minutes;
|
||||
int seconds;
|
||||
public:
|
||||
Time(int hours = 0, int minutes = 0, int seconds = 0) : hours(hours), minutes(minutes), seconds(seconds){}
|
||||
Time(const Time& copy){
|
||||
*this = copy;
|
||||
}
|
||||
// Binary Operators
|
||||
// Arithmetic Operators
|
||||
Time operator+(const Time& val) const{
|
||||
Time result;
|
||||
result.seconds = this->seconds + val.seconds;
|
||||
if(result.seconds>=60){
|
||||
result.seconds -= 60;
|
||||
result.minutes++;
|
||||
}
|
||||
result.minutes += this->minutes + val.minutes;
|
||||
if(result.minutes>=60){
|
||||
result.minutes -= 60;
|
||||
result.hours++;
|
||||
}
|
||||
result.hours += this->hours + val.hours;
|
||||
return result;
|
||||
}
|
||||
Time operator-(const Time& val) const{
|
||||
Time result;
|
||||
result.hours = this->hours - val.hours;
|
||||
if(result.hours<0) result.hours *= -1;
|
||||
result.minutes = this->minutes - val.minutes;
|
||||
if(result.minutes<0){
|
||||
result.hours--;
|
||||
result.minutes += 60;
|
||||
}
|
||||
result.seconds = this->seconds - val.seconds;
|
||||
if(result.seconds<0){
|
||||
result.minutes--;
|
||||
result.seconds += 60;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
// Compound Assignment Operators
|
||||
Time operator+=(const Time& rhs){
|
||||
return *this + rhs;
|
||||
}
|
||||
Time operator-=(const Time& rhs){
|
||||
return *this - rhs;
|
||||
}
|
||||
// Logical Operators
|
||||
bool operator==(const Time& val) const{
|
||||
return this->seconds == val.seconds && this->minutes == val.minutes && this->hours == val.hours;
|
||||
}
|
||||
bool operator!=(const Time& val) const{
|
||||
return !(*this == val);
|
||||
}
|
||||
bool operator<(const Time& val) const{
|
||||
if(this->hours<val.hours) return true;
|
||||
else if(this->hours>val.hours) return false;
|
||||
else if(this->minutes<val.minutes) return true;
|
||||
else if(this->minutes>val.minutes) return false;
|
||||
else return this->seconds<val.seconds;
|
||||
}
|
||||
bool operator<=(const Time& val) const;
|
||||
bool operator>(const Time& val) const;
|
||||
bool operator>=(const Time& val) const;
|
||||
// Additional Functions
|
||||
Time elapsedTime() const; // Calculate elapsed time
|
||||
~Time(){} // destructor
|
||||
friend std::ostream& operator<<(std::ostream& output, const Time& val); // outputs the Time
|
||||
friend std::istream& operator>>(std::istream& input, Time& val); // inputs the Time
|
||||
};
|
||||
ostream& operator<<(std::ostream& output, const Time& val){
|
||||
output<<"Hours "<<val.hours<<" Minutes "<<val.minutes<<" Seconds "<<val.seconds<<endl;
|
||||
}
|
||||
istream& operator>>(std::istream& input, Time& val){
|
||||
cout<<"Enter Hours: ";
|
||||
input>>val.hours;
|
||||
cout<<"Enter Minutes: ";
|
||||
input>>val.minutes;
|
||||
cout<<"Enter Seconds: ";
|
||||
input>>val.seconds;
|
||||
}
|
78
.config/Code/User/History/1613c77b/Ebc4.cpp
Normal file
78
.config/Code/User/History/1613c77b/Ebc4.cpp
Normal file
|
@ -0,0 +1,78 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Time{
|
||||
// You will need three integer data members to store the hours, minutes, and seconds.
|
||||
int hours;
|
||||
int minutes;
|
||||
int seconds;
|
||||
public:
|
||||
Time(int hours = 0, int minutes = 0, int seconds = 0) : hours(hours), minutes(minutes), seconds(seconds){}
|
||||
Time(const Time& copy){
|
||||
*this = copy;
|
||||
}
|
||||
// Binary Operators
|
||||
// Arithmetic Operators
|
||||
Time operator+(const Time& val) const{
|
||||
Time result;
|
||||
result.seconds = this->seconds + val.seconds;
|
||||
if(result.seconds>=60){
|
||||
result.seconds -= 60;
|
||||
result.minutes++;
|
||||
}
|
||||
result.minutes += this->minutes + val.minutes;
|
||||
if(result.minutes>=60){
|
||||
result.minutes -= 60;
|
||||
result.hours++;
|
||||
}
|
||||
result.hours += this->hours + val.hours;
|
||||
return result;
|
||||
}
|
||||
Time operator-(const Time& val) const{
|
||||
|
||||
// 2h 1m 40s - 1h 2m 50s
|
||||
Time result;
|
||||
result.hours = this->hours - val.hours;
|
||||
if(result.hours<0) result.hours *= -1;
|
||||
result.minutes = this->minutes - val.minutes;
|
||||
|
||||
result.seconds = this->seconds - val.seconds;
|
||||
if(result.seconds<0){
|
||||
|
||||
}
|
||||
}
|
||||
// Compound Assignment Operators
|
||||
Time operator+=(const Time& rhs){
|
||||
return *this + rhs;
|
||||
}
|
||||
Time operator-=(const Time& rhs){
|
||||
return *this - rhs;
|
||||
}
|
||||
// Logical Operators
|
||||
bool operator==(const Time& val) const{
|
||||
return this->seconds == val.seconds && this->minutes == val.minutes && this->hours == val.hours;
|
||||
}
|
||||
bool operator!=(const Time& val) const{
|
||||
return !(*this == val);
|
||||
}
|
||||
bool operator<(const Time& val) const;
|
||||
bool operator<=(const Time& val) const;
|
||||
bool operator>(const Time& val) const;
|
||||
bool operator>=(const Time& val) const;
|
||||
// Additional Functions
|
||||
Time elapsedTime() const; // Calculate elapsed time
|
||||
~Time(){} // destructor
|
||||
friend std::ostream& operator<<(std::ostream& output, const Time& val); // outputs the Time
|
||||
friend std::istream& operator>>(std::istream& input, Time& val); // inputs the Time
|
||||
};
|
||||
ostream& operator<<(std::ostream& output, const Time& val){
|
||||
output<<"Hours "<<val.hours<<" Minutes "<<val.minutes<<" Seconds "<<val.seconds<<endl;
|
||||
}
|
||||
istream& operator>>(std::istream& input, Time& val){
|
||||
cout<<"Enter Hours: ";
|
||||
input>>val.hours;
|
||||
cout<<"Enter Minutes: ";
|
||||
input>>val.minutes;
|
||||
cout<<"Enter Seconds: ";
|
||||
input>>val.seconds;
|
||||
}
|
95
.config/Code/User/History/1613c77b/FaRw.cpp
Normal file
95
.config/Code/User/History/1613c77b/FaRw.cpp
Normal file
|
@ -0,0 +1,95 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Time{
|
||||
// You will need three integer data members to store the hours, minutes, and seconds.
|
||||
int hours;
|
||||
int minutes;
|
||||
int seconds;
|
||||
public:
|
||||
Time(int hours = 0, int minutes = 0, int seconds = 0) : hours(hours), minutes(minutes), seconds(seconds){}
|
||||
Time(const Time& copy){
|
||||
*this = copy;
|
||||
}
|
||||
// Binary Operators
|
||||
// Arithmetic Operators
|
||||
Time operator+(const Time& val) const{
|
||||
Time result;
|
||||
result.seconds = this->seconds + val.seconds;
|
||||
if(result.seconds>=60){
|
||||
result.seconds -= 60;
|
||||
result.minutes++;
|
||||
}
|
||||
result.minutes += this->minutes + val.minutes;
|
||||
if(result.minutes>=60){
|
||||
result.minutes -= 60;
|
||||
result.hours++;
|
||||
}
|
||||
result.hours += this->hours + val.hours;
|
||||
return result;
|
||||
}
|
||||
Time operator-(const Time& val) const{
|
||||
Time result;
|
||||
result.hours = this->hours - val.hours;
|
||||
if(result.hours<0) result.hours *= -1;
|
||||
result.minutes = this->minutes - val.minutes;
|
||||
if(result.minutes<0){
|
||||
result.hours--;
|
||||
result.minutes += 60;
|
||||
}
|
||||
result.seconds = this->seconds - val.seconds;
|
||||
if(result.seconds<0){
|
||||
result.minutes--;
|
||||
result.seconds += 60;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
// Compound Assignment Operators
|
||||
Time operator+=(const Time& rhs){
|
||||
return *this + rhs;
|
||||
}
|
||||
Time operator-=(const Time& rhs){
|
||||
return *this - rhs;
|
||||
}
|
||||
// Logical Operators
|
||||
bool operator==(const Time& val) const{
|
||||
return this->seconds == val.seconds && this->minutes == val.minutes && this->hours == val.hours;
|
||||
}
|
||||
bool operator!=(const Time& val) const{
|
||||
return !(*this == val);
|
||||
}
|
||||
bool operator<(const Time& val) const{
|
||||
if(this->hours<val.hours) return true;
|
||||
else if(this->hours>val.hours) return false;
|
||||
else if(this->minutes<val.minutes) return true;
|
||||
else if(this->minutes>val.minutes) return false;
|
||||
else return this->seconds<val.seconds;
|
||||
}
|
||||
bool operator<=(const Time& val) const{
|
||||
|
||||
}
|
||||
bool operator>(const Time& val) const{
|
||||
if(this->hours>val.hours) return true;
|
||||
else if(this->hours<val.hours) return false;
|
||||
else if(this->minutes>val.minutes) return true;
|
||||
else if(this->minutes<val.minutes) return false;
|
||||
else return this->seconds>val.seconds;
|
||||
}
|
||||
bool operator>=(const Time& val) const;
|
||||
// Additional Functions
|
||||
Time elapsedTime() const; // Calculate elapsed time
|
||||
~Time(){} // destructor
|
||||
friend std::ostream& operator<<(std::ostream& output, const Time& val); // outputs the Time
|
||||
friend std::istream& operator>>(std::istream& input, Time& val); // inputs the Time
|
||||
};
|
||||
ostream& operator<<(std::ostream& output, const Time& val){
|
||||
output<<"Hours "<<val.hours<<" Minutes "<<val.minutes<<" Seconds "<<val.seconds<<endl;
|
||||
}
|
||||
istream& operator>>(std::istream& input, Time& val){
|
||||
cout<<"Enter Hours: ";
|
||||
input>>val.hours;
|
||||
cout<<"Enter Minutes: ";
|
||||
input>>val.minutes;
|
||||
cout<<"Enter Seconds: ";
|
||||
input>>val.seconds;
|
||||
}
|
82
.config/Code/User/History/1613c77b/GCQT.cpp
Normal file
82
.config/Code/User/History/1613c77b/GCQT.cpp
Normal file
|
@ -0,0 +1,82 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Time{
|
||||
// You will need three integer data members to store the hours, minutes, and seconds.
|
||||
int hours;
|
||||
int minutes;
|
||||
int seconds;
|
||||
public:
|
||||
Time(int hours = 0, int minutes = 0, int seconds = 0) : hours(hours), minutes(minutes), seconds(seconds){}
|
||||
Time(const Time& copy){
|
||||
*this = copy;
|
||||
}
|
||||
// Binary Operators
|
||||
// Arithmetic Operators
|
||||
Time operator+(const Time& val) const{
|
||||
Time result;
|
||||
result.seconds = this->seconds + val.seconds;
|
||||
if(result.seconds>=60){
|
||||
result.seconds -= 60;
|
||||
result.minutes++;
|
||||
}
|
||||
result.minutes += this->minutes + val.minutes;
|
||||
if(result.minutes>=60){
|
||||
result.minutes -= 60;
|
||||
result.hours++;
|
||||
}
|
||||
result.hours += this->hours + val.hours;
|
||||
return result;
|
||||
}
|
||||
Time operator-(const Time& val) const{
|
||||
|
||||
// 2h 1m 40s - 1h 2m 50s
|
||||
// 58m 50s
|
||||
Time result;
|
||||
result.hours = this->hours - val.hours;
|
||||
if(result.hours<0) result.hours *= -1;
|
||||
result.minutes = this->minutes - val.minutes;
|
||||
if(result.minutes<0){
|
||||
result.hours--;
|
||||
result.minutes += 60;
|
||||
}
|
||||
result.seconds = this->seconds - val.seconds;
|
||||
if(result.seconds<0){
|
||||
|
||||
}
|
||||
}
|
||||
// Compound Assignment Operators
|
||||
Time operator+=(const Time& rhs){
|
||||
return *this + rhs;
|
||||
}
|
||||
Time operator-=(const Time& rhs){
|
||||
return *this - rhs;
|
||||
}
|
||||
// Logical Operators
|
||||
bool operator==(const Time& val) const{
|
||||
return this->seconds == val.seconds && this->minutes == val.minutes && this->hours == val.hours;
|
||||
}
|
||||
bool operator!=(const Time& val) const{
|
||||
return !(*this == val);
|
||||
}
|
||||
bool operator<(const Time& val) const;
|
||||
bool operator<=(const Time& val) const;
|
||||
bool operator>(const Time& val) const;
|
||||
bool operator>=(const Time& val) const;
|
||||
// Additional Functions
|
||||
Time elapsedTime() const; // Calculate elapsed time
|
||||
~Time(){} // destructor
|
||||
friend std::ostream& operator<<(std::ostream& output, const Time& val); // outputs the Time
|
||||
friend std::istream& operator>>(std::istream& input, Time& val); // inputs the Time
|
||||
};
|
||||
ostream& operator<<(std::ostream& output, const Time& val){
|
||||
output<<"Hours "<<val.hours<<" Minutes "<<val.minutes<<" Seconds "<<val.seconds<<endl;
|
||||
}
|
||||
istream& operator>>(std::istream& input, Time& val){
|
||||
cout<<"Enter Hours: ";
|
||||
input>>val.hours;
|
||||
cout<<"Enter Minutes: ";
|
||||
input>>val.minutes;
|
||||
cout<<"Enter Seconds: ";
|
||||
input>>val.seconds;
|
||||
}
|
50
.config/Code/User/History/1613c77b/GjS4.cpp
Normal file
50
.config/Code/User/History/1613c77b/GjS4.cpp
Normal file
|
@ -0,0 +1,50 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Time{
|
||||
// You will need three integer data members to store the hours, minutes, and seconds.
|
||||
int hours;
|
||||
int minutes;
|
||||
int seconds;
|
||||
public:
|
||||
Time(int hours = 0, int minutes = 0, int seconds = 0) : hours(hours), minutes(minutes), seconds(seconds){}
|
||||
Time(const Time& copy){
|
||||
*this = copy;
|
||||
}
|
||||
// Binary Operators
|
||||
// Arithmetic Operators
|
||||
Time operator+(const Time& val) const{
|
||||
Time result;
|
||||
result.seconds = this->seconds + val.seconds;
|
||||
if(result.seconds>=60){
|
||||
result.seconds -= 60;
|
||||
result.minutes++;
|
||||
}
|
||||
result.minutes += this->minutes + val.minutes;
|
||||
if(result.minutes>=60){
|
||||
result.minutes -= 60;
|
||||
result.hours++;
|
||||
}
|
||||
result.hours += this->hours + val.hours;
|
||||
}
|
||||
Time operator-(const Time& val) const{
|
||||
|
||||
}
|
||||
// Compound Assignment Operators
|
||||
Time& operator+=(const Time& rhs){
|
||||
return Time(*this) + rhs;
|
||||
}
|
||||
Time& operator-=(const Time& rhs);
|
||||
// Logical Operators
|
||||
bool operator==(const Time& val) const;
|
||||
bool operator!=(const Time& val) const;
|
||||
bool operator<(const Time& val) const;
|
||||
bool operator<=(const Time& val) const;
|
||||
bool operator>(const Time& val) const;
|
||||
bool operator>=(const Time& val) const;
|
||||
// Additional Functions
|
||||
Time elapsedTime() const; // Calculate elapsed time
|
||||
~Time(); // destructor
|
||||
friend std::ostream& operator<<(std::ostream& output, const Time& val); // outputs the Time
|
||||
friend std::istream& operator>>(std::istream& input, Time& val); // inputs the Time
|
||||
};
|
48
.config/Code/User/History/1613c77b/H22N.cpp
Normal file
48
.config/Code/User/History/1613c77b/H22N.cpp
Normal file
|
@ -0,0 +1,48 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Time{
|
||||
// You will need three integer data members to store the hours, minutes, and seconds.
|
||||
int hours;
|
||||
int minutes;
|
||||
int seconds;
|
||||
public:
|
||||
Time(int hours = 0, int minutes = 0, int seconds = 0) : hours(hours), minutes(minutes), seconds(seconds){}
|
||||
Time(const Time& copy){
|
||||
*this = copy;
|
||||
}
|
||||
// Binary Operators
|
||||
// Arithmetic Operators
|
||||
Time operator+(const Time& val) const{
|
||||
Time result;
|
||||
result.seconds = this->seconds + val.seconds;
|
||||
if(result.seconds>=60){
|
||||
result.seconds -= 60;
|
||||
result.minutes++;
|
||||
}
|
||||
result.minutes += this->minutes + val.minutes;
|
||||
if(result.minutes>=60){
|
||||
result.minutes -= 60;
|
||||
result.hours++;
|
||||
}
|
||||
result.hours += this->hours + val.hours;
|
||||
}
|
||||
Time operator-(const Time& val) const{
|
||||
|
||||
}
|
||||
// Compound Assignment Operators
|
||||
Time& operator+=(const Time& rhs);
|
||||
Time& operator-=(const Time& rhs);
|
||||
// Logical Operators
|
||||
bool operator==(const Time& val) const;
|
||||
bool operator!=(const Time& val) const;
|
||||
bool operator<(const Time& val) const;
|
||||
bool operator<=(const Time& val) const;
|
||||
bool operator>(const Time& val) const;
|
||||
bool operator>=(const Time& val) const;
|
||||
// Additional Functions
|
||||
Time elapsedTime() const; // Calculate elapsed time
|
||||
~Time(); // destructor
|
||||
friend std::ostream& operator<<(std::ostream& output, const Time& val); // outputs the Time
|
||||
friend std::istream& operator>>(std::istream& input, Time& val); // inputs the Time
|
||||
};
|
68
.config/Code/User/History/1613c77b/HEuX.cpp
Normal file
68
.config/Code/User/History/1613c77b/HEuX.cpp
Normal file
|
@ -0,0 +1,68 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Time{
|
||||
// You will need three integer data members to store the hours, minutes, and seconds.
|
||||
int hours;
|
||||
int minutes;
|
||||
int seconds;
|
||||
public:
|
||||
Time(int hours = 0, int minutes = 0, int seconds = 0) : hours(hours), minutes(minutes), seconds(seconds){}
|
||||
Time(const Time& copy){
|
||||
*this = copy;
|
||||
}
|
||||
// Binary Operators
|
||||
// Arithmetic Operators
|
||||
Time operator+(const Time& val) const{
|
||||
Time result;
|
||||
result.seconds = this->seconds + val.seconds;
|
||||
if(result.seconds>=60){
|
||||
result.seconds -= 60;
|
||||
result.minutes++;
|
||||
}
|
||||
result.minutes += this->minutes + val.minutes;
|
||||
if(result.minutes>=60){
|
||||
result.minutes -= 60;
|
||||
result.hours++;
|
||||
}
|
||||
result.hours += this->hours + val.hours;
|
||||
return result;
|
||||
}
|
||||
Time operator-(const Time& val) const{
|
||||
|
||||
}
|
||||
// Compound Assignment Operators
|
||||
Time operator+=(const Time& rhs){
|
||||
return *this + rhs;
|
||||
}
|
||||
Time operator-=(const Time& rhs){
|
||||
return *this - rhs;
|
||||
}
|
||||
// Logical Operators
|
||||
bool operator==(const Time& val) const{
|
||||
return this->seconds == val.seconds && this->minutes == val.minutes && this->hours == val.hours;
|
||||
}
|
||||
bool operator!=(const Time& val) const{
|
||||
return !(*this == val);
|
||||
}
|
||||
bool operator<(const Time& val) const;
|
||||
bool operator<=(const Time& val) const;
|
||||
bool operator>(const Time& val) const;
|
||||
bool operator>=(const Time& val) const;
|
||||
// Additional Functions
|
||||
Time elapsedTime() const; // Calculate elapsed time
|
||||
~Time(){} // destructor
|
||||
friend std::ostream& operator<<(std::ostream& output, const Time& val); // outputs the Time
|
||||
friend std::istream& operator>>(std::istream& input, Time& val); // inputs the Time
|
||||
};
|
||||
ostream& operator<<(std::ostream& output, const Time& val){
|
||||
output<<"Hours "<<val.hours<<" Minutes "<<val.minutes<<" Seconds "<<val.seconds<<endl;
|
||||
}
|
||||
istream& operator>>(std::istream& input, Time& val){
|
||||
cout<<"Enter Hours: ";
|
||||
input>>val.hours;
|
||||
cout<<"Enter Minutes: ";
|
||||
input>>val.minutes;
|
||||
cout<<"Enter Seconds: ";
|
||||
input>>val.seconds;
|
||||
}
|
50
.config/Code/User/History/1613c77b/HIwI.cpp
Normal file
50
.config/Code/User/History/1613c77b/HIwI.cpp
Normal file
|
@ -0,0 +1,50 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Time{
|
||||
// You will need three integer data members to store the hours, minutes, and seconds.
|
||||
int hours;
|
||||
int minutes;
|
||||
int seconds;
|
||||
public:
|
||||
Time(int hours = 0, int minutes = 0, int seconds = 0) : hours(hours), minutes(minutes), seconds(seconds){}
|
||||
Time(const Time& copy){
|
||||
*this = copy;
|
||||
}
|
||||
// Binary Operators
|
||||
// Arithmetic Operators
|
||||
Time operator+(const Time& val) const{
|
||||
Time result;
|
||||
result.seconds = this->seconds + val.seconds;
|
||||
if(result.seconds>=60){
|
||||
result.seconds -= 60;
|
||||
result.minutes++;
|
||||
}
|
||||
result.minutes += this->minutes + val.minutes;
|
||||
if(result.minutes>=60){
|
||||
result.minutes -= 60;
|
||||
result.hours++;
|
||||
}
|
||||
result.hours += this->hours + val.hours;
|
||||
}
|
||||
Time operator-(const Time& val) const{
|
||||
|
||||
}
|
||||
// Compound Assignment Operators
|
||||
Time& operator+=(const Time& rhs){
|
||||
return *this + rhs;
|
||||
}
|
||||
Time& operator-=(const Time& rhs);
|
||||
// Logical Operators
|
||||
bool operator==(const Time& val) const;
|
||||
bool operator!=(const Time& val) const;
|
||||
bool operator<(const Time& val) const;
|
||||
bool operator<=(const Time& val) const;
|
||||
bool operator>(const Time& val) const;
|
||||
bool operator>=(const Time& val) const;
|
||||
// Additional Functions
|
||||
Time elapsedTime() const; // Calculate elapsed time
|
||||
~Time(); // destructor
|
||||
friend std::ostream& operator<<(std::ostream& output, const Time& val); // outputs the Time
|
||||
friend std::istream& operator>>(std::istream& input, Time& val); // inputs the Time
|
||||
};
|
50
.config/Code/User/History/1613c77b/Ig7I.cpp
Normal file
50
.config/Code/User/History/1613c77b/Ig7I.cpp
Normal file
|
@ -0,0 +1,50 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Time{
|
||||
// You will need three integer data members to store the hours, minutes, and seconds.
|
||||
int hours;
|
||||
int minutes;
|
||||
int seconds;
|
||||
public:
|
||||
Time(int hours = 0, int minutes = 0, int seconds = 0) : hours(hours), minutes(minutes), seconds(seconds){}
|
||||
Time(const Time& copy){
|
||||
*this = copy;
|
||||
}
|
||||
// Binary Operators
|
||||
// Arithmetic Operators
|
||||
Time operator+(const Time& val) const{
|
||||
Time result;
|
||||
result.seconds = this->seconds + val.seconds;
|
||||
if(result.seconds>=60){
|
||||
result.seconds -= 60;
|
||||
result.minutes++;
|
||||
}
|
||||
result.minutes += this->minutes + val.minutes;
|
||||
if(result.minutes>=60){
|
||||
result.minutes -= 60;
|
||||
result.hours++;
|
||||
}
|
||||
result.hours += this->hours + val.hours;
|
||||
}
|
||||
Time operator-(const Time& val) const{
|
||||
|
||||
}
|
||||
// Compound Assignment Operators
|
||||
Time operator+=(const Time& rhs){
|
||||
return *this + rhs;
|
||||
}
|
||||
Time& operator-=(const Time& rhs);
|
||||
// Logical Operators
|
||||
bool operator==(const Time& val) const;
|
||||
bool operator!=(const Time& val) const;
|
||||
bool operator<(const Time& val) const;
|
||||
bool operator<=(const Time& val) const;
|
||||
bool operator>(const Time& val) const;
|
||||
bool operator>=(const Time& val) const;
|
||||
// Additional Functions
|
||||
Time elapsedTime() const; // Calculate elapsed time
|
||||
~Time(); // destructor
|
||||
friend std::ostream& operator<<(std::ostream& output, const Time& val); // outputs the Time
|
||||
friend std::istream& operator>>(std::istream& input, Time& val); // inputs the Time
|
||||
};
|
77
.config/Code/User/History/1613c77b/LuxH.cpp
Normal file
77
.config/Code/User/History/1613c77b/LuxH.cpp
Normal file
|
@ -0,0 +1,77 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Time{
|
||||
// You will need three integer data members to store the hours, minutes, and seconds.
|
||||
int hours;
|
||||
int minutes;
|
||||
int seconds;
|
||||
public:
|
||||
Time(int hours = 0, int minutes = 0, int seconds = 0) : hours(hours), minutes(minutes), seconds(seconds){}
|
||||
Time(const Time& copy){
|
||||
*this = copy;
|
||||
}
|
||||
// Binary Operators
|
||||
// Arithmetic Operators
|
||||
Time operator+(const Time& val) const{
|
||||
Time result;
|
||||
result.seconds = this->seconds + val.seconds;
|
||||
if(result.seconds>=60){
|
||||
result.seconds -= 60;
|
||||
result.minutes++;
|
||||
}
|
||||
result.minutes += this->minutes + val.minutes;
|
||||
if(result.minutes>=60){
|
||||
result.minutes -= 60;
|
||||
result.hours++;
|
||||
}
|
||||
result.hours += this->hours + val.hours;
|
||||
return result;
|
||||
}
|
||||
Time operator-(const Time& val) const{
|
||||
|
||||
// 2h 5m 40s - 1h 2m 50s
|
||||
Time result;
|
||||
result.hours = this->hours - val.hours;
|
||||
if(result.hours<0) result.hours *= -1;
|
||||
result.minutes = this->minutes - val.minutes;
|
||||
result.seconds = this->seconds - val.seconds;
|
||||
if(result.seconds<0){
|
||||
|
||||
}
|
||||
}
|
||||
// Compound Assignment Operators
|
||||
Time operator+=(const Time& rhs){
|
||||
return *this + rhs;
|
||||
}
|
||||
Time operator-=(const Time& rhs){
|
||||
return *this - rhs;
|
||||
}
|
||||
// Logical Operators
|
||||
bool operator==(const Time& val) const{
|
||||
return this->seconds == val.seconds && this->minutes == val.minutes && this->hours == val.hours;
|
||||
}
|
||||
bool operator!=(const Time& val) const{
|
||||
return !(*this == val);
|
||||
}
|
||||
bool operator<(const Time& val) const;
|
||||
bool operator<=(const Time& val) const;
|
||||
bool operator>(const Time& val) const;
|
||||
bool operator>=(const Time& val) const;
|
||||
// Additional Functions
|
||||
Time elapsedTime() const; // Calculate elapsed time
|
||||
~Time(){} // destructor
|
||||
friend std::ostream& operator<<(std::ostream& output, const Time& val); // outputs the Time
|
||||
friend std::istream& operator>>(std::istream& input, Time& val); // inputs the Time
|
||||
};
|
||||
ostream& operator<<(std::ostream& output, const Time& val){
|
||||
output<<"Hours "<<val.hours<<" Minutes "<<val.minutes<<" Seconds "<<val.seconds<<endl;
|
||||
}
|
||||
istream& operator>>(std::istream& input, Time& val){
|
||||
cout<<"Enter Hours: ";
|
||||
input>>val.hours;
|
||||
cout<<"Enter Minutes: ";
|
||||
input>>val.minutes;
|
||||
cout<<"Enter Seconds: ";
|
||||
input>>val.seconds;
|
||||
}
|
79
.config/Code/User/History/1613c77b/M1kT.cpp
Normal file
79
.config/Code/User/History/1613c77b/M1kT.cpp
Normal file
|
@ -0,0 +1,79 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Time{
|
||||
// You will need three integer data members to store the hours, minutes, and seconds.
|
||||
int hours;
|
||||
int minutes;
|
||||
int seconds;
|
||||
public:
|
||||
Time(int hours = 0, int minutes = 0, int seconds = 0) : hours(hours), minutes(minutes), seconds(seconds){}
|
||||
Time(const Time& copy){
|
||||
*this = copy;
|
||||
}
|
||||
// Binary Operators
|
||||
// Arithmetic Operators
|
||||
Time operator+(const Time& val) const{
|
||||
Time result;
|
||||
result.seconds = this->seconds + val.seconds;
|
||||
if(result.seconds>=60){
|
||||
result.seconds -= 60;
|
||||
result.minutes++;
|
||||
}
|
||||
result.minutes += this->minutes + val.minutes;
|
||||
if(result.minutes>=60){
|
||||
result.minutes -= 60;
|
||||
result.hours++;
|
||||
}
|
||||
result.hours += this->hours + val.hours;
|
||||
return result;
|
||||
}
|
||||
Time operator-(const Time& val) const{
|
||||
|
||||
// 2h 1m 40s - 1h 2m 50s
|
||||
// 58m 50s
|
||||
Time result;
|
||||
result.hours = this->hours - val.hours;
|
||||
if(result.hours<0) result.hours *= -1;
|
||||
result.minutes = this->minutes - val.minutes;
|
||||
|
||||
result.seconds = this->seconds - val.seconds;
|
||||
if(result.seconds<0){
|
||||
|
||||
}
|
||||
}
|
||||
// Compound Assignment Operators
|
||||
Time operator+=(const Time& rhs){
|
||||
return *this + rhs;
|
||||
}
|
||||
Time operator-=(const Time& rhs){
|
||||
return *this - rhs;
|
||||
}
|
||||
// Logical Operators
|
||||
bool operator==(const Time& val) const{
|
||||
return this->seconds == val.seconds && this->minutes == val.minutes && this->hours == val.hours;
|
||||
}
|
||||
bool operator!=(const Time& val) const{
|
||||
return !(*this == val);
|
||||
}
|
||||
bool operator<(const Time& val) const;
|
||||
bool operator<=(const Time& val) const;
|
||||
bool operator>(const Time& val) const;
|
||||
bool operator>=(const Time& val) const;
|
||||
// Additional Functions
|
||||
Time elapsedTime() const; // Calculate elapsed time
|
||||
~Time(){} // destructor
|
||||
friend std::ostream& operator<<(std::ostream& output, const Time& val); // outputs the Time
|
||||
friend std::istream& operator>>(std::istream& input, Time& val); // inputs the Time
|
||||
};
|
||||
ostream& operator<<(std::ostream& output, const Time& val){
|
||||
output<<"Hours "<<val.hours<<" Minutes "<<val.minutes<<" Seconds "<<val.seconds<<endl;
|
||||
}
|
||||
istream& operator>>(std::istream& input, Time& val){
|
||||
cout<<"Enter Hours: ";
|
||||
input>>val.hours;
|
||||
cout<<"Enter Minutes: ";
|
||||
input>>val.minutes;
|
||||
cout<<"Enter Seconds: ";
|
||||
input>>val.seconds;
|
||||
}
|
50
.config/Code/User/History/1613c77b/SL3Q.cpp
Normal file
50
.config/Code/User/History/1613c77b/SL3Q.cpp
Normal file
|
@ -0,0 +1,50 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Time{
|
||||
// You will need three integer data members to store the hours, minutes, and seconds.
|
||||
int hours;
|
||||
int minutes;
|
||||
int seconds;
|
||||
public:
|
||||
Time(int hours = 0, int minutes = 0, int seconds = 0) : hours(hours), minutes(minutes), seconds(seconds){}
|
||||
Time(const Time& copy){
|
||||
*this = copy;
|
||||
}
|
||||
// Binary Operators
|
||||
// Arithmetic Operators
|
||||
Time operator+(const Time& val) const{
|
||||
Time result;
|
||||
result.seconds = this->seconds + val.seconds;
|
||||
if(result.seconds>=60){
|
||||
result.seconds -= 60;
|
||||
result.minutes++;
|
||||
}
|
||||
result.minutes += this->minutes + val.minutes;
|
||||
if(result.minutes>=60){
|
||||
result.minutes -= 60;
|
||||
result.hours++;
|
||||
}
|
||||
result.hours += this->hours + val.hours;
|
||||
}
|
||||
Time operator-(const Time& val) const{
|
||||
|
||||
}
|
||||
// Compound Assignment Operators
|
||||
Time& operator+=(const Time& rhs){
|
||||
return rhs + *this;
|
||||
}
|
||||
Time& operator-=(const Time& rhs);
|
||||
// Logical Operators
|
||||
bool operator==(const Time& val) const;
|
||||
bool operator!=(const Time& val) const;
|
||||
bool operator<(const Time& val) const;
|
||||
bool operator<=(const Time& val) const;
|
||||
bool operator>(const Time& val) const;
|
||||
bool operator>=(const Time& val) const;
|
||||
// Additional Functions
|
||||
Time elapsedTime() const; // Calculate elapsed time
|
||||
~Time(); // destructor
|
||||
friend std::ostream& operator<<(std::ostream& output, const Time& val); // outputs the Time
|
||||
friend std::istream& operator>>(std::istream& input, Time& val); // inputs the Time
|
||||
};
|
107
.config/Code/User/History/1613c77b/THUo.cpp
Normal file
107
.config/Code/User/History/1613c77b/THUo.cpp
Normal file
|
@ -0,0 +1,107 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Time{
|
||||
// You will need three integer data members to store the hours, minutes, and seconds.
|
||||
int hours;
|
||||
int minutes;
|
||||
int seconds;
|
||||
public:
|
||||
Time(int hours=0, int minutes=0, int seconds=0) : hours(hours), minutes(minutes), seconds(seconds){
|
||||
|
||||
}
|
||||
Time(const Time& copy){
|
||||
*this = copy;
|
||||
}
|
||||
// Binary Operators
|
||||
// Arithmetic Operators
|
||||
Time operator+(const Time& val) const{
|
||||
Time result;
|
||||
result.seconds = this->seconds + val.seconds;
|
||||
if(result.seconds>=60){
|
||||
result.seconds -= 60;
|
||||
result.minutes++;
|
||||
}
|
||||
result.minutes += this->minutes + val.minutes;
|
||||
if(result.minutes>=60){
|
||||
result.minutes -= 60;
|
||||
result.hours++;
|
||||
}
|
||||
result.hours += this->hours + val.hours;
|
||||
return result;
|
||||
}
|
||||
Time operator-(const Time& val) const{
|
||||
Time result;
|
||||
result.hours = this->hours - val.hours;
|
||||
if(result.hours<0) result.hours *= -1;
|
||||
result.minutes = this->minutes - val.minutes;
|
||||
if(result.minutes<0){
|
||||
result.hours--;
|
||||
result.minutes += 60;
|
||||
}
|
||||
result.seconds = this->seconds - val.seconds;
|
||||
if(result.seconds<0){
|
||||
result.minutes--;
|
||||
result.seconds += 60;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
// Compound Assignment Operators
|
||||
Time operator+=(const Time& rhs){
|
||||
return *this + rhs;
|
||||
}
|
||||
Time operator-=(const Time& rhs){
|
||||
return *this - rhs;
|
||||
}
|
||||
// Logical Operators
|
||||
bool operator==(const Time& val) const{
|
||||
return this->seconds == val.seconds && this->minutes == val.minutes && this->hours == val.hours;
|
||||
}
|
||||
bool operator!=(const Time& val) const{
|
||||
return !(*this == val);
|
||||
}
|
||||
bool operator<(const Time& val) const{
|
||||
if(this->hours<val.hours) return true;
|
||||
else if(this->hours>val.hours) return false;
|
||||
else if(this->minutes<val.minutes) return true;
|
||||
else if(this->minutes>val.minutes) return false;
|
||||
else return this->seconds<val.seconds;
|
||||
}
|
||||
bool operator<=(const Time& val) const{
|
||||
if(this->hours<val.hours) return true;
|
||||
else if(this->hours>val.hours) return false;
|
||||
else if(this->minutes<val.minutes) return true;
|
||||
else if(this->minutes>val.minutes) return false;
|
||||
else return this->seconds<=val.seconds;
|
||||
}
|
||||
bool operator>(const Time& val) const{
|
||||
if(this->hours>val.hours) return true;
|
||||
else if(this->hours<val.hours) return false;
|
||||
else if(this->minutes>val.minutes) return true;
|
||||
else if(this->minutes<val.minutes) return false;
|
||||
else return this->seconds>val.seconds;
|
||||
}
|
||||
bool operator>=(const Time& val) const{
|
||||
if(this->hours>val.hours) return true;
|
||||
else if(this->hours<val.hours) return false;
|
||||
else if(this->minutes>val.minutes) return true;
|
||||
else if(this->minutes<val.minutes) return false;
|
||||
else return this->seconds>=val.seconds;
|
||||
}
|
||||
// Additional Functions
|
||||
Time elapsedTime() const{} // Calculate elapsed time
|
||||
~Time(){} // destructor
|
||||
friend std::ostream& operator<<(std::ostream& output, const Time& val); // outputs the Time
|
||||
friend std::istream& operator>>(std::istream& input, Time& val); // inputs the Time
|
||||
};
|
||||
ostream& operator<<(std::ostream& output, const Time& val){
|
||||
output<<"Hours "<<val.hours<<" Minutes "<<val.minutes<<" Seconds "<<val.seconds<<endl;
|
||||
}
|
||||
istream& operator>>(std::istream& input, Time& val){
|
||||
cout<<"Enter Hours: ";
|
||||
input>>val.hours;
|
||||
cout<<"Enter Minutes: ";
|
||||
input>>val.minutes;
|
||||
cout<<"Enter Seconds: ";
|
||||
input>>val.seconds;
|
||||
}
|
53
.config/Code/User/History/1613c77b/U4Lm.cpp
Normal file
53
.config/Code/User/History/1613c77b/U4Lm.cpp
Normal file
|
@ -0,0 +1,53 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Time{
|
||||
// You will need three integer data members to store the hours, minutes, and seconds.
|
||||
int hours;
|
||||
int minutes;
|
||||
int seconds;
|
||||
public:
|
||||
Time(int hours = 0, int minutes = 0, int seconds = 0) : hours(hours), minutes(minutes), seconds(seconds){}
|
||||
Time(const Time& copy){
|
||||
*this = copy;
|
||||
}
|
||||
// Binary Operators
|
||||
// Arithmetic Operators
|
||||
Time operator+(const Time& val) const{
|
||||
Time result;
|
||||
result.seconds = this->seconds + val.seconds;
|
||||
if(result.seconds>=60){
|
||||
result.seconds -= 60;
|
||||
result.minutes++;
|
||||
}
|
||||
result.minutes += this->minutes + val.minutes;
|
||||
if(result.minutes>=60){
|
||||
result.minutes -= 60;
|
||||
result.hours++;
|
||||
}
|
||||
result.hours += this->hours + val.hours;
|
||||
return result;
|
||||
}
|
||||
Time operator-(const Time& val) const{
|
||||
|
||||
}
|
||||
// Compound Assignment Operators
|
||||
Time operator+=(const Time& rhs){
|
||||
return *this + rhs;
|
||||
}
|
||||
Time operator-=(const Time& rhs){
|
||||
|
||||
}
|
||||
// Logical Operators
|
||||
bool operator==(const Time& val) const;
|
||||
bool operator!=(const Time& val) const;
|
||||
bool operator<(const Time& val) const;
|
||||
bool operator<=(const Time& val) const;
|
||||
bool operator>(const Time& val) const;
|
||||
bool operator>=(const Time& val) const;
|
||||
// Additional Functions
|
||||
Time elapsedTime() const; // Calculate elapsed time
|
||||
~Time(); // destructor
|
||||
friend std::ostream& operator<<(std::ostream& output, const Time& val); // outputs the Time
|
||||
friend std::istream& operator>>(std::istream& input, Time& val); // inputs the Time
|
||||
};
|
50
.config/Code/User/History/1613c77b/UcBW.cpp
Normal file
50
.config/Code/User/History/1613c77b/UcBW.cpp
Normal file
|
@ -0,0 +1,50 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Time{
|
||||
// You will need three integer data members to store the hours, minutes, and seconds.
|
||||
int hours;
|
||||
int minutes;
|
||||
int seconds;
|
||||
public:
|
||||
Time(int hours = 0, int minutes = 0, int seconds = 0) : hours(hours), minutes(minutes), seconds(seconds){}
|
||||
Time(const Time& copy){
|
||||
*this = copy;
|
||||
}
|
||||
// Binary Operators
|
||||
// Arithmetic Operators
|
||||
Time operator+(const Time& val) const{
|
||||
Time result;
|
||||
result.seconds = this->seconds + val.seconds;
|
||||
if(result.seconds>=60){
|
||||
result.seconds -= 60;
|
||||
result.minutes++;
|
||||
}
|
||||
result.minutes += this->minutes + val.minutes;
|
||||
if(result.minutes>=60){
|
||||
result.minutes -= 60;
|
||||
result.hours++;
|
||||
}
|
||||
result.hours += this->hours + val.hours;
|
||||
}
|
||||
Time operator-(const Time& val) const{
|
||||
|
||||
}
|
||||
// Compound Assignment Operators
|
||||
Time& operator+=(const Time& rhs){
|
||||
return *this + rhs;
|
||||
}
|
||||
Time& operator-=(const Time& rhs);
|
||||
// Logical Operators
|
||||
bool operator==(const Time& val) const;
|
||||
bool operator!=(const Time& val) const;
|
||||
bool operator<(const Time& val) const;
|
||||
bool operator<=(const Time& val) const;
|
||||
bool operator>(const Time& val) const;
|
||||
bool operator>=(const Time& val) const;
|
||||
// Additional Functions
|
||||
Time elapsedTime() const; // Calculate elapsed time
|
||||
~Time(); // destructor
|
||||
friend std::ostream& operator<<(std::ostream& output, const Time& val); // outputs the Time
|
||||
friend std::istream& operator>>(std::istream& input, Time& val); // inputs the Time
|
||||
};
|
55
.config/Code/User/History/1613c77b/Vudn.cpp
Normal file
55
.config/Code/User/History/1613c77b/Vudn.cpp
Normal file
|
@ -0,0 +1,55 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Time{
|
||||
// You will need three integer data members to store the hours, minutes, and seconds.
|
||||
int hours;
|
||||
int minutes;
|
||||
int seconds;
|
||||
public:
|
||||
Time(int hours = 0, int minutes = 0, int seconds = 0) : hours(hours), minutes(minutes), seconds(seconds){}
|
||||
Time(const Time& copy){
|
||||
*this = copy;
|
||||
}
|
||||
// Binary Operators
|
||||
// Arithmetic Operators
|
||||
Time operator+(const Time& val) const{
|
||||
Time result;
|
||||
result.seconds = this->seconds + val.seconds;
|
||||
if(result.seconds>=60){
|
||||
result.seconds -= 60;
|
||||
result.minutes++;
|
||||
}
|
||||
result.minutes += this->minutes + val.minutes;
|
||||
if(result.minutes>=60){
|
||||
result.minutes -= 60;
|
||||
result.hours++;
|
||||
}
|
||||
result.hours += this->hours + val.hours;
|
||||
return result;
|
||||
}
|
||||
Time operator-(const Time& val) const{
|
||||
|
||||
}
|
||||
// Compound Assignment Operators
|
||||
Time operator+=(const Time& rhs){
|
||||
return *this + rhs;
|
||||
}
|
||||
Time operator-=(const Time& rhs){
|
||||
return *this - rhs;
|
||||
}
|
||||
// Logical Operators
|
||||
bool operator==(const Time& val) const{
|
||||
return this->seconds == val.seconds && this->minutes == val.minutes && this->hours == val.hours;
|
||||
}
|
||||
bool operator!=(const Time& val) const;
|
||||
bool operator<(const Time& val) const;
|
||||
bool operator<=(const Time& val) const;
|
||||
bool operator>(const Time& val) const;
|
||||
bool operator>=(const Time& val) const;
|
||||
// Additional Functions
|
||||
Time elapsedTime() const; // Calculate elapsed time
|
||||
~Time(); // destructor
|
||||
friend std::ostream& operator<<(std::ostream& output, const Time& val); // outputs the Time
|
||||
friend std::istream& operator>>(std::istream& input, Time& val); // inputs the Time
|
||||
};
|
95
.config/Code/User/History/1613c77b/WSaW.cpp
Normal file
95
.config/Code/User/History/1613c77b/WSaW.cpp
Normal file
|
@ -0,0 +1,95 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Time{
|
||||
// You will need three integer data members to store the hours, minutes, and seconds.
|
||||
int hours;
|
||||
int minutes;
|
||||
int seconds;
|
||||
public:
|
||||
Time(int hours = 0, int minutes = 0, int seconds = 0) : hours(hours), minutes(minutes), seconds(seconds){}
|
||||
Time(const Time& copy){
|
||||
*this = copy;
|
||||
}
|
||||
// Binary Operators
|
||||
// Arithmetic Operators
|
||||
Time operator+(const Time& val) const{
|
||||
Time result;
|
||||
result.seconds = this->seconds + val.seconds;
|
||||
if(result.seconds>=60){
|
||||
result.seconds -= 60;
|
||||
result.minutes++;
|
||||
}
|
||||
result.minutes += this->minutes + val.minutes;
|
||||
if(result.minutes>=60){
|
||||
result.minutes -= 60;
|
||||
result.hours++;
|
||||
}
|
||||
result.hours += this->hours + val.hours;
|
||||
return result;
|
||||
}
|
||||
Time operator-(const Time& val) const{
|
||||
Time result;
|
||||
result.hours = this->hours - val.hours;
|
||||
if(result.hours<0) result.hours *= -1;
|
||||
result.minutes = this->minutes - val.minutes;
|
||||
if(result.minutes<0){
|
||||
result.hours--;
|
||||
result.minutes += 60;
|
||||
}
|
||||
result.seconds = this->seconds - val.seconds;
|
||||
if(result.seconds<0){
|
||||
result.minutes--;
|
||||
result.seconds += 60;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
// Compound Assignment Operators
|
||||
Time operator+=(const Time& rhs){
|
||||
return *this + rhs;
|
||||
}
|
||||
Time operator-=(const Time& rhs){
|
||||
return *this - rhs;
|
||||
}
|
||||
// Logical Operators
|
||||
bool operator==(const Time& val) const{
|
||||
return this->seconds == val.seconds && this->minutes == val.minutes && this->hours == val.hours;
|
||||
}
|
||||
bool operator!=(const Time& val) const{
|
||||
return !(*this == val);
|
||||
}
|
||||
bool operator<(const Time& val) const{
|
||||
if(this->hours<val.hours) return true;
|
||||
else if(this->hours>val.hours) return false;
|
||||
else if(this->minutes<val.minutes) return true;
|
||||
else if(this->minutes>val.minutes) return false;
|
||||
else return this->seconds<val.seconds;
|
||||
}
|
||||
bool operator<=(const Time& val) const{
|
||||
|
||||
}
|
||||
bool operator>(const Time& val) const{
|
||||
if(this->hours<val.hours) return true;
|
||||
else if(this->hours>val.hours) return false;
|
||||
else if(this->minutes<val.minutes) return true;
|
||||
else if(this->minutes>val.minutes) return false;
|
||||
else return this->seconds<val.seconds;
|
||||
}
|
||||
bool operator>=(const Time& val) const;
|
||||
// Additional Functions
|
||||
Time elapsedTime() const; // Calculate elapsed time
|
||||
~Time(){} // destructor
|
||||
friend std::ostream& operator<<(std::ostream& output, const Time& val); // outputs the Time
|
||||
friend std::istream& operator>>(std::istream& input, Time& val); // inputs the Time
|
||||
};
|
||||
ostream& operator<<(std::ostream& output, const Time& val){
|
||||
output<<"Hours "<<val.hours<<" Minutes "<<val.minutes<<" Seconds "<<val.seconds<<endl;
|
||||
}
|
||||
istream& operator>>(std::istream& input, Time& val){
|
||||
cout<<"Enter Hours: ";
|
||||
input>>val.hours;
|
||||
cout<<"Enter Minutes: ";
|
||||
input>>val.minutes;
|
||||
cout<<"Enter Seconds: ";
|
||||
input>>val.seconds;
|
||||
}
|
69
.config/Code/User/History/1613c77b/X22N.cpp
Normal file
69
.config/Code/User/History/1613c77b/X22N.cpp
Normal file
|
@ -0,0 +1,69 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Time{
|
||||
// You will need three integer data members to store the hours, minutes, and seconds.
|
||||
int hours;
|
||||
int minutes;
|
||||
int seconds;
|
||||
public:
|
||||
Time(int hours = 0, int minutes = 0, int seconds = 0) : hours(hours), minutes(minutes), seconds(seconds){}
|
||||
Time(const Time& copy){
|
||||
*this = copy;
|
||||
}
|
||||
// Binary Operators
|
||||
// Arithmetic Operators
|
||||
Time operator+(const Time& val) const{
|
||||
Time result;
|
||||
result.seconds = this->seconds + val.seconds;
|
||||
if(result.seconds>=60){
|
||||
result.seconds -= 60;
|
||||
result.minutes++;
|
||||
}
|
||||
result.minutes += this->minutes + val.minutes;
|
||||
if(result.minutes>=60){
|
||||
result.minutes -= 60;
|
||||
result.hours++;
|
||||
}
|
||||
result.hours += this->hours + val.hours;
|
||||
return result;
|
||||
}
|
||||
Time operator-(const Time& val) const{
|
||||
Time result;
|
||||
result.seconds = this->seconds - val.seconds;
|
||||
}
|
||||
// Compound Assignment Operators
|
||||
Time operator+=(const Time& rhs){
|
||||
return *this + rhs;
|
||||
}
|
||||
Time operator-=(const Time& rhs){
|
||||
return *this - rhs;
|
||||
}
|
||||
// Logical Operators
|
||||
bool operator==(const Time& val) const{
|
||||
return this->seconds == val.seconds && this->minutes == val.minutes && this->hours == val.hours;
|
||||
}
|
||||
bool operator!=(const Time& val) const{
|
||||
return !(*this == val);
|
||||
}
|
||||
bool operator<(const Time& val) const;
|
||||
bool operator<=(const Time& val) const;
|
||||
bool operator>(const Time& val) const;
|
||||
bool operator>=(const Time& val) const;
|
||||
// Additional Functions
|
||||
Time elapsedTime() const; // Calculate elapsed time
|
||||
~Time(){} // destructor
|
||||
friend std::ostream& operator<<(std::ostream& output, const Time& val); // outputs the Time
|
||||
friend std::istream& operator>>(std::istream& input, Time& val); // inputs the Time
|
||||
};
|
||||
ostream& operator<<(std::ostream& output, const Time& val){
|
||||
output<<"Hours "<<val.hours<<" Minutes "<<val.minutes<<" Seconds "<<val.seconds<<endl;
|
||||
}
|
||||
istream& operator>>(std::istream& input, Time& val){
|
||||
cout<<"Enter Hours: ";
|
||||
input>>val.hours;
|
||||
cout<<"Enter Minutes: ";
|
||||
input>>val.minutes;
|
||||
cout<<"Enter Seconds: ";
|
||||
input>>val.seconds;
|
||||
}
|
51
.config/Code/User/History/1613c77b/XGKg.cpp
Normal file
51
.config/Code/User/History/1613c77b/XGKg.cpp
Normal file
|
@ -0,0 +1,51 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Time{
|
||||
// You will need three integer data members to store the hours, minutes, and seconds.
|
||||
int hours;
|
||||
int minutes;
|
||||
int seconds;
|
||||
public:
|
||||
Time(int hours = 0, int minutes = 0, int seconds = 0) : hours(hours), minutes(minutes), seconds(seconds){}
|
||||
Time(const Time& copy){
|
||||
*this = copy;
|
||||
}
|
||||
// Binary Operators
|
||||
// Arithmetic Operators
|
||||
Time operator+(const Time& val) const{
|
||||
Time result;
|
||||
result.seconds = this->seconds + val.seconds;
|
||||
if(result.seconds>=60){
|
||||
result.seconds -= 60;
|
||||
result.minutes++;
|
||||
}
|
||||
result.minutes += this->minutes + val.minutes;
|
||||
if(result.minutes>=60){
|
||||
result.minutes -= 60;
|
||||
result.hours++;
|
||||
}
|
||||
result.hours += this->hours + val.hours;
|
||||
return result;
|
||||
}
|
||||
Time operator-(const Time& val) const{
|
||||
|
||||
}
|
||||
// Compound Assignment Operators
|
||||
Time& operator+=(const Time& rhs){
|
||||
return *this + rhs;
|
||||
}
|
||||
Time& operator-=(const Time& rhs);
|
||||
// Logical Operators
|
||||
bool operator==(const Time& val) const;
|
||||
bool operator!=(const Time& val) const;
|
||||
bool operator<(const Time& val) const;
|
||||
bool operator<=(const Time& val) const;
|
||||
bool operator>(const Time& val) const;
|
||||
bool operator>=(const Time& val) const;
|
||||
// Additional Functions
|
||||
Time elapsedTime() const; // Calculate elapsed time
|
||||
~Time(); // destructor
|
||||
friend std::ostream& operator<<(std::ostream& output, const Time& val); // outputs the Time
|
||||
friend std::istream& operator>>(std::istream& input, Time& val); // inputs the Time
|
||||
};
|
55
.config/Code/User/History/1613c77b/Yy0b.cpp
Normal file
55
.config/Code/User/History/1613c77b/Yy0b.cpp
Normal file
|
@ -0,0 +1,55 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Time{
|
||||
// You will need three integer data members to store the hours, minutes, and seconds.
|
||||
int hours;
|
||||
int minutes;
|
||||
int seconds;
|
||||
public:
|
||||
Time(int hours = 0, int minutes = 0, int seconds = 0) : hours(hours), minutes(minutes), seconds(seconds){}
|
||||
Time(const Time& copy){
|
||||
*this = copy;
|
||||
}
|
||||
// Binary Operators
|
||||
// Arithmetic Operators
|
||||
Time operator+(const Time& val) const{
|
||||
Time result;
|
||||
result.seconds = this->seconds + val.seconds;
|
||||
if(result.seconds>=60){
|
||||
result.seconds -= 60;
|
||||
result.minutes++;
|
||||
}
|
||||
result.minutes += this->minutes + val.minutes;
|
||||
if(result.minutes>=60){
|
||||
result.minutes -= 60;
|
||||
result.hours++;
|
||||
}
|
||||
result.hours += this->hours + val.hours;
|
||||
return result;
|
||||
}
|
||||
Time operator-(const Time& val) const{
|
||||
|
||||
}
|
||||
// Compound Assignment Operators
|
||||
Time operator+=(const Time& rhs){
|
||||
return *this + rhs;
|
||||
}
|
||||
Time operator-=(const Time& rhs){
|
||||
return *this - rhs;
|
||||
}
|
||||
// Logical Operators
|
||||
bool operator==(const Time& val) const{
|
||||
|
||||
}
|
||||
bool operator!=(const Time& val) const;
|
||||
bool operator<(const Time& val) const;
|
||||
bool operator<=(const Time& val) const;
|
||||
bool operator>(const Time& val) const;
|
||||
bool operator>=(const Time& val) const;
|
||||
// Additional Functions
|
||||
Time elapsedTime() const; // Calculate elapsed time
|
||||
~Time(); // destructor
|
||||
friend std::ostream& operator<<(std::ostream& output, const Time& val); // outputs the Time
|
||||
friend std::istream& operator>>(std::istream& input, Time& val); // inputs the Time
|
||||
};
|
107
.config/Code/User/History/1613c77b/eEYD.cpp
Normal file
107
.config/Code/User/History/1613c77b/eEYD.cpp
Normal file
|
@ -0,0 +1,107 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Time{
|
||||
// You will need three integer data members to store the hours, minutes, and seconds.
|
||||
int hours;
|
||||
int minutes;
|
||||
int seconds;
|
||||
public:
|
||||
Time(int hours=0, int minutes=0, int seconds=0){
|
||||
|
||||
}
|
||||
Time(const Time& copy){
|
||||
*this = copy;
|
||||
}
|
||||
// Binary Operators
|
||||
// Arithmetic Operators
|
||||
Time operator+(const Time& val) const{
|
||||
Time result;
|
||||
result.seconds = this->seconds + val.seconds;
|
||||
if(result.seconds>=60){
|
||||
result.seconds -= 60;
|
||||
result.minutes++;
|
||||
}
|
||||
result.minutes += this->minutes + val.minutes;
|
||||
if(result.minutes>=60){
|
||||
result.minutes -= 60;
|
||||
result.hours++;
|
||||
}
|
||||
result.hours += this->hours + val.hours;
|
||||
return result;
|
||||
}
|
||||
Time operator-(const Time& val) const{
|
||||
Time result;
|
||||
result.hours = this->hours - val.hours;
|
||||
if(result.hours<0) result.hours *= -1;
|
||||
result.minutes = this->minutes - val.minutes;
|
||||
if(result.minutes<0){
|
||||
result.hours--;
|
||||
result.minutes += 60;
|
||||
}
|
||||
result.seconds = this->seconds - val.seconds;
|
||||
if(result.seconds<0){
|
||||
result.minutes--;
|
||||
result.seconds += 60;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
// Compound Assignment Operators
|
||||
Time operator+=(const Time& rhs){
|
||||
return *this + rhs;
|
||||
}
|
||||
Time operator-=(const Time& rhs){
|
||||
return *this - rhs;
|
||||
}
|
||||
// Logical Operators
|
||||
bool operator==(const Time& val) const{
|
||||
return this->seconds == val.seconds && this->minutes == val.minutes && this->hours == val.hours;
|
||||
}
|
||||
bool operator!=(const Time& val) const{
|
||||
return !(*this == val);
|
||||
}
|
||||
bool operator<(const Time& val) const{
|
||||
if(this->hours<val.hours) return true;
|
||||
else if(this->hours>val.hours) return false;
|
||||
else if(this->minutes<val.minutes) return true;
|
||||
else if(this->minutes>val.minutes) return false;
|
||||
else return this->seconds<val.seconds;
|
||||
}
|
||||
bool operator<=(const Time& val) const{
|
||||
if(this->hours<val.hours) return true;
|
||||
else if(this->hours>val.hours) return false;
|
||||
else if(this->minutes<val.minutes) return true;
|
||||
else if(this->minutes>val.minutes) return false;
|
||||
else return this->seconds<=val.seconds;
|
||||
}
|
||||
bool operator>(const Time& val) const{
|
||||
if(this->hours>val.hours) return true;
|
||||
else if(this->hours<val.hours) return false;
|
||||
else if(this->minutes>val.minutes) return true;
|
||||
else if(this->minutes<val.minutes) return false;
|
||||
else return this->seconds>val.seconds;
|
||||
}
|
||||
bool operator>=(const Time& val) const{
|
||||
if(this->hours>val.hours) return true;
|
||||
else if(this->hours<val.hours) return false;
|
||||
else if(this->minutes>val.minutes) return true;
|
||||
else if(this->minutes<val.minutes) return false;
|
||||
else return this->seconds>=val.seconds;
|
||||
}
|
||||
// Additional Functions
|
||||
Time elapsedTime() const{} // Calculate elapsed time
|
||||
~Time(){} // destructor
|
||||
friend std::ostream& operator<<(std::ostream& output, const Time& val); // outputs the Time
|
||||
friend std::istream& operator>>(std::istream& input, Time& val); // inputs the Time
|
||||
};
|
||||
ostream& operator<<(std::ostream& output, const Time& val){
|
||||
output<<"Hours "<<val.hours<<" Minutes "<<val.minutes<<" Seconds "<<val.seconds<<endl;
|
||||
}
|
||||
istream& operator>>(std::istream& input, Time& val){
|
||||
cout<<"Enter Hours: ";
|
||||
input>>val.hours;
|
||||
cout<<"Enter Minutes: ";
|
||||
input>>val.minutes;
|
||||
cout<<"Enter Seconds: ";
|
||||
input>>val.seconds;
|
||||
}
|
1
.config/Code/User/History/1613c77b/entries.json
Normal file
1
.config/Code/User/History/1613c77b/entries.json
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":1,"resource":"file:///home/rafayahmad/Stuff/OOP%20Assignment%2004/Q5.cpp","entries":[{"id":"i1zA.cpp","timestamp":1713420012475},{"id":"0dTT.cpp","timestamp":1713420052673},{"id":"m4fw.cpp","timestamp":1713420610012},{"id":"vYNq.cpp","timestamp":1713420627060},{"id":"H22N.cpp","timestamp":1713420650404},{"id":"3YfV.cpp","timestamp":1713420662378},{"id":"UcBW.cpp","timestamp":1713420708686},{"id":"GjS4.cpp","timestamp":1713420724389},{"id":"ywQu.cpp","timestamp":1713420735579},{"id":"SL3Q.cpp","timestamp":1713420756400},{"id":"4ryE.cpp","timestamp":1713420810603},{"id":"jJm7.cpp","timestamp":1713420832040},{"id":"BDfR.cpp","timestamp":1713420849313},{"id":"pxAz.cpp","timestamp":1713420895726},{"id":"HIwI.cpp","timestamp":1713420918183},{"id":"Ig7I.cpp","timestamp":1713421163887},{"id":"XGKg.cpp","timestamp":1713421189670},{"id":"U4Lm.cpp","timestamp":1713421218270},{"id":"B1ey.cpp","timestamp":1713421228545},{"id":"Yy0b.cpp","timestamp":1713421246186},{"id":"Vudn.cpp","timestamp":1713421276383},{"id":"jsoC.cpp","timestamp":1713421292528},{"id":"CpTI.cpp","timestamp":1713421307170},{"id":"vKUk.cpp","timestamp":1713421340561},{"id":"k27g.cpp","timestamp":1713421366689},{"id":"7jWH.cpp","timestamp":1713421453972},{"id":"uBgV.cpp","timestamp":1713421535163},{"id":"vT2t.cpp","timestamp":1713421678493},{"id":"HEuX.cpp","timestamp":1713421695379},{"id":"sYWJ.cpp","timestamp":1713443345613},{"id":"X22N.cpp","timestamp":1713443435174},{"id":"004r.cpp","timestamp":1713443516432},{"id":"swvn.cpp","timestamp":1713443560405},{"id":"91q4.cpp","timestamp":1713443581486},{"id":"LuxH.cpp","timestamp":1713443610989},{"id":"Ebc4.cpp","timestamp":1713443628386},{"id":"xrdb.cpp","timestamp":1713443708273},{"id":"M1kT.cpp","timestamp":1713443747076},{"id":"k6im.cpp","timestamp":1713443803964},{"id":"GCQT.cpp","timestamp":1713443827053},{"id":"C00E.cpp","timestamp":1713443855395},{"id":"D9zf.cpp","timestamp":1713443942952},{"id":"WSaW.cpp","timestamp":1713443965578},{"id":"FaRw.cpp","timestamp":1713443978245},{"id":"2Bsh.cpp","timestamp":1713444009762},{"id":"krLn.cpp","timestamp":1713444023463},{"id":"idhP.cpp","timestamp":1713444063128},{"id":"eEYD.cpp","timestamp":1713444089712},{"id":"THUo.cpp","timestamp":1713444116583},{"id":"Cbc3.cpp","timestamp":1713444195995}]}
|
40
.config/Code/User/History/1613c77b/i1zA.cpp
Normal file
40
.config/Code/User/History/1613c77b/i1zA.cpp
Normal file
|
@ -0,0 +1,40 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Time{
|
||||
// You will need three integer data members to store the hours, minutes, and seconds.
|
||||
int hours;
|
||||
int minutes;
|
||||
int seconds;
|
||||
public:
|
||||
Time(int hours = 0, int minutes = 0, int seconds = 0) : hours(hours), minutes(minutes), seconds(seconds){}
|
||||
Time(const Time& copy){
|
||||
*this = copy;
|
||||
}
|
||||
// Binary Operators
|
||||
// Arithmetic Operators
|
||||
Time operator+(const Time& val) const{
|
||||
Time result;
|
||||
result.seconds = this->seconds + val.seconds;
|
||||
if(result.seconds>=60){
|
||||
result.seconds -= 60;
|
||||
result.minutes++;
|
||||
}
|
||||
}
|
||||
Time operator-(const Time& val) const;
|
||||
// Compound Assignment Operators
|
||||
Time& operator+=(const Time& rhs);
|
||||
Time& operator-=(const Time& rhs);
|
||||
// Logical Operators
|
||||
bool operator==(const Time& val) const;
|
||||
bool operator!=(const Time& val) const;
|
||||
bool operator<(const Time& val) const;
|
||||
bool operator<=(const Time& val) const;
|
||||
bool operator>(const Time& val) const;
|
||||
bool operator>=(const Time& val) const;
|
||||
// Additional Functions
|
||||
Time elapsedTime() const; // Calculate elapsed time
|
||||
~Time(); // destructor
|
||||
friend std::ostream& operator<<(std::ostream& output, const Time& val); // outputs the Time
|
||||
friend std::istream& operator>>(std::istream& input, Time& val); // inputs the Time
|
||||
};
|
105
.config/Code/User/History/1613c77b/idhP.cpp
Normal file
105
.config/Code/User/History/1613c77b/idhP.cpp
Normal file
|
@ -0,0 +1,105 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Time{
|
||||
// You will need three integer data members to store the hours, minutes, and seconds.
|
||||
int hours;
|
||||
int minutes;
|
||||
int seconds;
|
||||
public:
|
||||
Time(int hours = 0, int minutes = 0, int seconds = 0) : hours(hours), minutes(minutes), seconds(seconds){}
|
||||
Time(const Time& copy){
|
||||
*this = copy;
|
||||
}
|
||||
// Binary Operators
|
||||
// Arithmetic Operators
|
||||
Time operator+(const Time& val) const{
|
||||
Time result;
|
||||
result.seconds = this->seconds + val.seconds;
|
||||
if(result.seconds>=60){
|
||||
result.seconds -= 60;
|
||||
result.minutes++;
|
||||
}
|
||||
result.minutes += this->minutes + val.minutes;
|
||||
if(result.minutes>=60){
|
||||
result.minutes -= 60;
|
||||
result.hours++;
|
||||
}
|
||||
result.hours += this->hours + val.hours;
|
||||
return result;
|
||||
}
|
||||
Time operator-(const Time& val) const{
|
||||
Time result;
|
||||
result.hours = this->hours - val.hours;
|
||||
if(result.hours<0) result.hours *= -1;
|
||||
result.minutes = this->minutes - val.minutes;
|
||||
if(result.minutes<0){
|
||||
result.hours--;
|
||||
result.minutes += 60;
|
||||
}
|
||||
result.seconds = this->seconds - val.seconds;
|
||||
if(result.seconds<0){
|
||||
result.minutes--;
|
||||
result.seconds += 60;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
// Compound Assignment Operators
|
||||
Time operator+=(const Time& rhs){
|
||||
return *this + rhs;
|
||||
}
|
||||
Time operator-=(const Time& rhs){
|
||||
return *this - rhs;
|
||||
}
|
||||
// Logical Operators
|
||||
bool operator==(const Time& val) const{
|
||||
return this->seconds == val.seconds && this->minutes == val.minutes && this->hours == val.hours;
|
||||
}
|
||||
bool operator!=(const Time& val) const{
|
||||
return !(*this == val);
|
||||
}
|
||||
bool operator<(const Time& val) const{
|
||||
if(this->hours<val.hours) return true;
|
||||
else if(this->hours>val.hours) return false;
|
||||
else if(this->minutes<val.minutes) return true;
|
||||
else if(this->minutes>val.minutes) return false;
|
||||
else return this->seconds<val.seconds;
|
||||
}
|
||||
bool operator<=(const Time& val) const{
|
||||
if(this->hours<val.hours) return true;
|
||||
else if(this->hours>val.hours) return false;
|
||||
else if(this->minutes<val.minutes) return true;
|
||||
else if(this->minutes>val.minutes) return false;
|
||||
else return this->seconds<=val.seconds;
|
||||
}
|
||||
bool operator>(const Time& val) const{
|
||||
if(this->hours>val.hours) return true;
|
||||
else if(this->hours<val.hours) return false;
|
||||
else if(this->minutes>val.minutes) return true;
|
||||
else if(this->minutes<val.minutes) return false;
|
||||
else return this->seconds>val.seconds;
|
||||
}
|
||||
bool operator>=(const Time& val) const{
|
||||
if(this->hours>val.hours) return true;
|
||||
else if(this->hours<val.hours) return false;
|
||||
else if(this->minutes>val.minutes) return true;
|
||||
else if(this->minutes<val.minutes) return false;
|
||||
else return this->seconds>=val.seconds;
|
||||
}
|
||||
// Additional Functions
|
||||
Time elapsedTime() const{} // Calculate elapsed time
|
||||
~Time(){} // destructor
|
||||
friend std::ostream& operator<<(std::ostream& output, const Time& val); // outputs the Time
|
||||
friend std::istream& operator>>(std::istream& input, Time& val); // inputs the Time
|
||||
};
|
||||
ostream& operator<<(std::ostream& output, const Time& val){
|
||||
output<<"Hours "<<val.hours<<" Minutes "<<val.minutes<<" Seconds "<<val.seconds<<endl;
|
||||
}
|
||||
istream& operator>>(std::istream& input, Time& val){
|
||||
cout<<"Enter Hours: ";
|
||||
input>>val.hours;
|
||||
cout<<"Enter Minutes: ";
|
||||
input>>val.minutes;
|
||||
cout<<"Enter Seconds: ";
|
||||
input>>val.seconds;
|
||||
}
|
50
.config/Code/User/History/1613c77b/jJm7.cpp
Normal file
50
.config/Code/User/History/1613c77b/jJm7.cpp
Normal file
|
@ -0,0 +1,50 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Time{
|
||||
// You will need three integer data members to store the hours, minutes, and seconds.
|
||||
int hours;
|
||||
int minutes;
|
||||
int seconds;
|
||||
public:
|
||||
Time(int hours = 0, int minutes = 0, int seconds = 0) : hours(hours), minutes(minutes), seconds(seconds){}
|
||||
Time(const Time& copy){
|
||||
*this = copy;
|
||||
}
|
||||
// Binary Operators
|
||||
// Arithmetic Operators
|
||||
Time operator+(const Time& val) const{
|
||||
Time result;
|
||||
result.seconds = this->seconds + val.seconds;
|
||||
if(result.seconds>=60){
|
||||
result.seconds -= 60;
|
||||
result.minutes++;
|
||||
}
|
||||
result.minutes += this->minutes + val.minutes;
|
||||
if(result.minutes>=60){
|
||||
result.minutes -= 60;
|
||||
result.hours++;
|
||||
}
|
||||
result.hours += this->hours + val.hours;
|
||||
}
|
||||
Time operator-(const Time& val) const{
|
||||
|
||||
}
|
||||
// Compound Assignment Operators
|
||||
Time& operator+=(const Time& rhs){
|
||||
return rhs + *this;
|
||||
}
|
||||
Time& operator-=(const Time& rhs);
|
||||
// Logical Operators
|
||||
bool operator==(const Time& val) const;
|
||||
bool operator!=(const Time& val) const;
|
||||
bool operator<(const Time& val) const;
|
||||
bool operator<=(const Time& val) const;
|
||||
bool operator>(const Time& val) const;
|
||||
bool operator>=(const Time& val) const;
|
||||
// Additional Functions
|
||||
Time elapsedTime() const; // Calculate elapsed time
|
||||
~Time(); // destructor
|
||||
friend std::ostream& operator<<(std::ostream& output, const Time& val); // outputs the Time
|
||||
friend std::istream& operator>>(std::istream& input, Time& val); // inputs the Time
|
||||
};
|
57
.config/Code/User/History/1613c77b/jsoC.cpp
Normal file
57
.config/Code/User/History/1613c77b/jsoC.cpp
Normal file
|
@ -0,0 +1,57 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Time{
|
||||
// You will need three integer data members to store the hours, minutes, and seconds.
|
||||
int hours;
|
||||
int minutes;
|
||||
int seconds;
|
||||
public:
|
||||
Time(int hours = 0, int minutes = 0, int seconds = 0) : hours(hours), minutes(minutes), seconds(seconds){}
|
||||
Time(const Time& copy){
|
||||
*this = copy;
|
||||
}
|
||||
// Binary Operators
|
||||
// Arithmetic Operators
|
||||
Time operator+(const Time& val) const{
|
||||
Time result;
|
||||
result.seconds = this->seconds + val.seconds;
|
||||
if(result.seconds>=60){
|
||||
result.seconds -= 60;
|
||||
result.minutes++;
|
||||
}
|
||||
result.minutes += this->minutes + val.minutes;
|
||||
if(result.minutes>=60){
|
||||
result.minutes -= 60;
|
||||
result.hours++;
|
||||
}
|
||||
result.hours += this->hours + val.hours;
|
||||
return result;
|
||||
}
|
||||
Time operator-(const Time& val) const{
|
||||
|
||||
}
|
||||
// Compound Assignment Operators
|
||||
Time operator+=(const Time& rhs){
|
||||
return *this + rhs;
|
||||
}
|
||||
Time operator-=(const Time& rhs){
|
||||
return *this - rhs;
|
||||
}
|
||||
// Logical Operators
|
||||
bool operator==(const Time& val) const{
|
||||
return this->seconds == val.seconds && this->minutes == val.minutes && this->hours == val.hours;
|
||||
}
|
||||
bool operator!=(const Time& val) const{
|
||||
return !(*this == val);
|
||||
}
|
||||
bool operator<(const Time& val) const;
|
||||
bool operator<=(const Time& val) const;
|
||||
bool operator>(const Time& val) const;
|
||||
bool operator>=(const Time& val) const;
|
||||
// Additional Functions
|
||||
Time elapsedTime() const; // Calculate elapsed time
|
||||
~Time(); // destructor
|
||||
friend std::ostream& operator<<(std::ostream& output, const Time& val); // outputs the Time
|
||||
friend std::istream& operator>>(std::istream& input, Time& val); // inputs the Time
|
||||
};
|
63
.config/Code/User/History/1613c77b/k27g.cpp
Normal file
63
.config/Code/User/History/1613c77b/k27g.cpp
Normal file
|
@ -0,0 +1,63 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Time{
|
||||
// You will need three integer data members to store the hours, minutes, and seconds.
|
||||
int hours;
|
||||
int minutes;
|
||||
int seconds;
|
||||
public:
|
||||
Time(int hours = 0, int minutes = 0, int seconds = 0) : hours(hours), minutes(minutes), seconds(seconds){}
|
||||
Time(const Time& copy){
|
||||
*this = copy;
|
||||
}
|
||||
// Binary Operators
|
||||
// Arithmetic Operators
|
||||
Time operator+(const Time& val) const{
|
||||
Time result;
|
||||
result.seconds = this->seconds + val.seconds;
|
||||
if(result.seconds>=60){
|
||||
result.seconds -= 60;
|
||||
result.minutes++;
|
||||
}
|
||||
result.minutes += this->minutes + val.minutes;
|
||||
if(result.minutes>=60){
|
||||
result.minutes -= 60;
|
||||
result.hours++;
|
||||
}
|
||||
result.hours += this->hours + val.hours;
|
||||
return result;
|
||||
}
|
||||
Time operator-(const Time& val) const{
|
||||
|
||||
}
|
||||
// Compound Assignment Operators
|
||||
Time operator+=(const Time& rhs){
|
||||
return *this + rhs;
|
||||
}
|
||||
Time operator-=(const Time& rhs){
|
||||
return *this - rhs;
|
||||
}
|
||||
// Logical Operators
|
||||
bool operator==(const Time& val) const{
|
||||
return this->seconds == val.seconds && this->minutes == val.minutes && this->hours == val.hours;
|
||||
}
|
||||
bool operator!=(const Time& val) const{
|
||||
return !(*this == val);
|
||||
}
|
||||
bool operator<(const Time& val) const;
|
||||
bool operator<=(const Time& val) const;
|
||||
bool operator>(const Time& val) const;
|
||||
bool operator>=(const Time& val) const;
|
||||
// Additional Functions
|
||||
Time elapsedTime() const; // Calculate elapsed time
|
||||
~Time(){} // destructor
|
||||
friend std::ostream& operator<<(std::ostream& output, const Time& val); // outputs the Time
|
||||
friend std::istream& operator>>(std::istream& input, Time& val); // inputs the Time
|
||||
};
|
||||
ostream& operator<<(std::ostream& output, const Time& val){
|
||||
|
||||
}
|
||||
istream& operator>>(std::istream& input, Time& val){
|
||||
|
||||
}
|
81
.config/Code/User/History/1613c77b/k6im.cpp
Normal file
81
.config/Code/User/History/1613c77b/k6im.cpp
Normal file
|
@ -0,0 +1,81 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Time{
|
||||
// You will need three integer data members to store the hours, minutes, and seconds.
|
||||
int hours;
|
||||
int minutes;
|
||||
int seconds;
|
||||
public:
|
||||
Time(int hours = 0, int minutes = 0, int seconds = 0) : hours(hours), minutes(minutes), seconds(seconds){}
|
||||
Time(const Time& copy){
|
||||
*this = copy;
|
||||
}
|
||||
// Binary Operators
|
||||
// Arithmetic Operators
|
||||
Time operator+(const Time& val) const{
|
||||
Time result;
|
||||
result.seconds = this->seconds + val.seconds;
|
||||
if(result.seconds>=60){
|
||||
result.seconds -= 60;
|
||||
result.minutes++;
|
||||
}
|
||||
result.minutes += this->minutes + val.minutes;
|
||||
if(result.minutes>=60){
|
||||
result.minutes -= 60;
|
||||
result.hours++;
|
||||
}
|
||||
result.hours += this->hours + val.hours;
|
||||
return result;
|
||||
}
|
||||
Time operator-(const Time& val) const{
|
||||
|
||||
// 2h 1m 40s - 1h 2m 50s
|
||||
// 58m 50s
|
||||
Time result;
|
||||
result.hours = this->hours - val.hours;
|
||||
if(result.hours<0) result.hours *= -1;
|
||||
result.minutes = this->minutes - val.minutes;
|
||||
if(result.minutes<0){
|
||||
|
||||
}
|
||||
result.seconds = this->seconds - val.seconds;
|
||||
if(result.seconds<0){
|
||||
|
||||
}
|
||||
}
|
||||
// Compound Assignment Operators
|
||||
Time operator+=(const Time& rhs){
|
||||
return *this + rhs;
|
||||
}
|
||||
Time operator-=(const Time& rhs){
|
||||
return *this - rhs;
|
||||
}
|
||||
// Logical Operators
|
||||
bool operator==(const Time& val) const{
|
||||
return this->seconds == val.seconds && this->minutes == val.minutes && this->hours == val.hours;
|
||||
}
|
||||
bool operator!=(const Time& val) const{
|
||||
return !(*this == val);
|
||||
}
|
||||
bool operator<(const Time& val) const;
|
||||
bool operator<=(const Time& val) const;
|
||||
bool operator>(const Time& val) const;
|
||||
bool operator>=(const Time& val) const;
|
||||
// Additional Functions
|
||||
Time elapsedTime() const; // Calculate elapsed time
|
||||
~Time(){} // destructor
|
||||
friend std::ostream& operator<<(std::ostream& output, const Time& val); // outputs the Time
|
||||
friend std::istream& operator>>(std::istream& input, Time& val); // inputs the Time
|
||||
};
|
||||
ostream& operator<<(std::ostream& output, const Time& val){
|
||||
output<<"Hours "<<val.hours<<" Minutes "<<val.minutes<<" Seconds "<<val.seconds<<endl;
|
||||
}
|
||||
istream& operator>>(std::istream& input, Time& val){
|
||||
cout<<"Enter Hours: ";
|
||||
input>>val.hours;
|
||||
cout<<"Enter Minutes: ";
|
||||
input>>val.minutes;
|
||||
cout<<"Enter Seconds: ";
|
||||
input>>val.seconds;
|
||||
}
|
99
.config/Code/User/History/1613c77b/krLn.cpp
Normal file
99
.config/Code/User/History/1613c77b/krLn.cpp
Normal file
|
@ -0,0 +1,99 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Time{
|
||||
// You will need three integer data members to store the hours, minutes, and seconds.
|
||||
int hours;
|
||||
int minutes;
|
||||
int seconds;
|
||||
public:
|
||||
Time(int hours = 0, int minutes = 0, int seconds = 0) : hours(hours), minutes(minutes), seconds(seconds){}
|
||||
Time(const Time& copy){
|
||||
*this = copy;
|
||||
}
|
||||
// Binary Operators
|
||||
// Arithmetic Operators
|
||||
Time operator+(const Time& val) const{
|
||||
Time result;
|
||||
result.seconds = this->seconds + val.seconds;
|
||||
if(result.seconds>=60){
|
||||
result.seconds -= 60;
|
||||
result.minutes++;
|
||||
}
|
||||
result.minutes += this->minutes + val.minutes;
|
||||
if(result.minutes>=60){
|
||||
result.minutes -= 60;
|
||||
result.hours++;
|
||||
}
|
||||
result.hours += this->hours + val.hours;
|
||||
return result;
|
||||
}
|
||||
Time operator-(const Time& val) const{
|
||||
Time result;
|
||||
result.hours = this->hours - val.hours;
|
||||
if(result.hours<0) result.hours *= -1;
|
||||
result.minutes = this->minutes - val.minutes;
|
||||
if(result.minutes<0){
|
||||
result.hours--;
|
||||
result.minutes += 60;
|
||||
}
|
||||
result.seconds = this->seconds - val.seconds;
|
||||
if(result.seconds<0){
|
||||
result.minutes--;
|
||||
result.seconds += 60;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
// Compound Assignment Operators
|
||||
Time operator+=(const Time& rhs){
|
||||
return *this + rhs;
|
||||
}
|
||||
Time operator-=(const Time& rhs){
|
||||
return *this - rhs;
|
||||
}
|
||||
// Logical Operators
|
||||
bool operator==(const Time& val) const{
|
||||
return this->seconds == val.seconds && this->minutes == val.minutes && this->hours == val.hours;
|
||||
}
|
||||
bool operator!=(const Time& val) const{
|
||||
return !(*this == val);
|
||||
}
|
||||
bool operator<(const Time& val) const{
|
||||
if(this->hours<val.hours) return true;
|
||||
else if(this->hours>val.hours) return false;
|
||||
else if(this->minutes<val.minutes) return true;
|
||||
else if(this->minutes>val.minutes) return false;
|
||||
else return this->seconds<val.seconds;
|
||||
}
|
||||
bool operator<=(const Time& val) const{
|
||||
if(this->hours<val.hours) return true;
|
||||
else if(this->hours>val.hours) return false;
|
||||
else if(this->minutes<val.minutes) return true;
|
||||
else if(this->minutes>val.minutes) return false;
|
||||
else return this->seconds<=val.seconds;
|
||||
}
|
||||
bool operator>(const Time& val) const{
|
||||
if(this->hours>val.hours) return true;
|
||||
else if(this->hours<val.hours) return false;
|
||||
else if(this->minutes>val.minutes) return true;
|
||||
else if(this->minutes<val.minutes) return false;
|
||||
else return this->seconds>val.seconds;
|
||||
}
|
||||
bool operator>=(const Time& val) const;
|
||||
// Additional Functions
|
||||
Time elapsedTime() const; // Calculate elapsed time
|
||||
~Time(){} // destructor
|
||||
friend std::ostream& operator<<(std::ostream& output, const Time& val); // outputs the Time
|
||||
friend std::istream& operator>>(std::istream& input, Time& val); // inputs the Time
|
||||
};
|
||||
ostream& operator<<(std::ostream& output, const Time& val){
|
||||
output<<"Hours "<<val.hours<<" Minutes "<<val.minutes<<" Seconds "<<val.seconds<<endl;
|
||||
}
|
||||
istream& operator>>(std::istream& input, Time& val){
|
||||
cout<<"Enter Hours: ";
|
||||
input>>val.hours;
|
||||
cout<<"Enter Minutes: ";
|
||||
input>>val.minutes;
|
||||
cout<<"Enter Seconds: ";
|
||||
input>>val.seconds;
|
||||
}
|
44
.config/Code/User/History/1613c77b/m4fw.cpp
Normal file
44
.config/Code/User/History/1613c77b/m4fw.cpp
Normal file
|
@ -0,0 +1,44 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Time{
|
||||
// You will need three integer data members to store the hours, minutes, and seconds.
|
||||
int hours;
|
||||
int minutes;
|
||||
int seconds;
|
||||
public:
|
||||
Time(int hours = 0, int minutes = 0, int seconds = 0) : hours(hours), minutes(minutes), seconds(seconds){}
|
||||
Time(const Time& copy){
|
||||
*this = copy;
|
||||
}
|
||||
// Binary Operators
|
||||
// Arithmetic Operators
|
||||
Time operator+(const Time& val) const{
|
||||
Time result;
|
||||
result.seconds = this->seconds + val.seconds;
|
||||
if(result.seconds>=60){
|
||||
result.seconds -= 60;
|
||||
result.minutes++;
|
||||
}
|
||||
result.minutes += this->minutes + val.minutes;
|
||||
if(result.minutes>=60){
|
||||
|
||||
}
|
||||
}
|
||||
Time operator-(const Time& val) const;
|
||||
// Compound Assignment Operators
|
||||
Time& operator+=(const Time& rhs);
|
||||
Time& operator-=(const Time& rhs);
|
||||
// Logical Operators
|
||||
bool operator==(const Time& val) const;
|
||||
bool operator!=(const Time& val) const;
|
||||
bool operator<(const Time& val) const;
|
||||
bool operator<=(const Time& val) const;
|
||||
bool operator>(const Time& val) const;
|
||||
bool operator>=(const Time& val) const;
|
||||
// Additional Functions
|
||||
Time elapsedTime() const; // Calculate elapsed time
|
||||
~Time(); // destructor
|
||||
friend std::ostream& operator<<(std::ostream& output, const Time& val); // outputs the Time
|
||||
friend std::istream& operator>>(std::istream& input, Time& val); // inputs the Time
|
||||
};
|
50
.config/Code/User/History/1613c77b/pxAz.cpp
Normal file
50
.config/Code/User/History/1613c77b/pxAz.cpp
Normal file
|
@ -0,0 +1,50 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Time{
|
||||
// You will need three integer data members to store the hours, minutes, and seconds.
|
||||
int hours;
|
||||
int minutes;
|
||||
int seconds;
|
||||
public:
|
||||
Time(int hours = 0, int minutes = 0, int seconds = 0) : hours(hours), minutes(minutes), seconds(seconds){}
|
||||
Time(const Time& copy){
|
||||
*this = copy;
|
||||
}
|
||||
// Binary Operators
|
||||
// Arithmetic Operators
|
||||
Time operator+(const Time& val) const{
|
||||
Time result;
|
||||
result.seconds = this->seconds + val.seconds;
|
||||
if(result.seconds>=60){
|
||||
result.seconds -= 60;
|
||||
result.minutes++;
|
||||
}
|
||||
result.minutes += this->minutes + val.minutes;
|
||||
if(result.minutes>=60){
|
||||
result.minutes -= 60;
|
||||
result.hours++;
|
||||
}
|
||||
result.hours += this->hours + val.hours;
|
||||
}
|
||||
Time operator-(const Time& val) const{
|
||||
|
||||
}
|
||||
// Compound Assignment Operators
|
||||
Time& operator+=(const Time& rhs){
|
||||
return *this + rhs;
|
||||
}
|
||||
Time& operator-=(const Time& rhs);
|
||||
// Logical Operators
|
||||
bool operator==(const Time& val) const;
|
||||
bool operator!=(const Time& val) const;
|
||||
bool operator<(const Time& val) const;
|
||||
bool operator<=(const Time& val) const;
|
||||
bool operator>(const Time& val) const;
|
||||
bool operator>=(const Time& val) const;
|
||||
// Additional Functions
|
||||
Time elapsedTime() const; // Calculate elapsed time
|
||||
~Time(); // destructor
|
||||
friend std::ostream& operator<<(std::ostream& output, const Time& val); // outputs the Time
|
||||
friend std::istream& operator>>(std::istream& input, Time& val); // inputs the Time
|
||||
};
|
68
.config/Code/User/History/1613c77b/sYWJ.cpp
Normal file
68
.config/Code/User/History/1613c77b/sYWJ.cpp
Normal file
|
@ -0,0 +1,68 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Time{
|
||||
// You will need three integer data members to store the hours, minutes, and seconds.
|
||||
int hours;
|
||||
int minutes;
|
||||
int seconds;
|
||||
public:
|
||||
Time(int hours = 0, int minutes = 0, int seconds = 0) : hours(hours), minutes(minutes), seconds(seconds){}
|
||||
Time(const Time& copy){
|
||||
*this = copy;
|
||||
}
|
||||
// Binary Operators
|
||||
// Arithmetic Operators
|
||||
Time operator+(const Time& val) const{
|
||||
Time result;
|
||||
result.seconds = this->seconds + val.seconds;
|
||||
if(result.seconds>=60){
|
||||
result.seconds -= 60;
|
||||
result.minutes++;
|
||||
}
|
||||
result.minutes += this->minutes + val.minutes;
|
||||
if(result.minutes>=60){
|
||||
result.minutes -= 60;
|
||||
result.hours++;
|
||||
}
|
||||
result.hours += this->hours + val.hours;
|
||||
return result;
|
||||
}
|
||||
Time operator-(const Time& val) const{
|
||||
|
||||
}
|
||||
// Compound Assignment Operators
|
||||
Time operator+=(const Time& rhs){
|
||||
return *this + rhs;
|
||||
}
|
||||
Time operator-=(const Time& rhs){
|
||||
return *this - rhs;
|
||||
}
|
||||
// Logical Operators
|
||||
bool operator==(const Time& val) const{
|
||||
return this->seconds == val.seconds && this->minutes == val.minutes && this->hours == val.hours;
|
||||
}
|
||||
bool operator!=(const Time& val) const{
|
||||
return !(*this == val);
|
||||
}
|
||||
bool operator<(const Time& val) const;
|
||||
bool operator<=(const Time& val) const;
|
||||
bool operator>(const Time& val) const;
|
||||
bool operator>=(const Time& val) const;
|
||||
// Additional Functions
|
||||
Time elapsedTime() const; // Calculate elapsed time
|
||||
~Time(){} // destructor
|
||||
friend std::ostream& operator<<(std::ostream& output, const Time& val); // outputs the Time
|
||||
friend std::istream& operator>>(std::istream& input, Time& val); // inputs the Time
|
||||
};
|
||||
ostream& operator<<(std::ostream& output, const Time& val){
|
||||
output<<"Hours "<<val.hours<<" Minutes "<<val.minutes<<" Seconds "<<val.seconds<<endl;
|
||||
}
|
||||
istream& operator>>(std::istream& input, Time& val){
|
||||
cout<<"Enter Hours: ";
|
||||
input>>val.hours;
|
||||
cout<<"Enter Minutes: ";
|
||||
input>>val.minutes;
|
||||
cout<<"Enter Seconds: ";
|
||||
input>>val.seconds;
|
||||
}
|
75
.config/Code/User/History/1613c77b/swvn.cpp
Normal file
75
.config/Code/User/History/1613c77b/swvn.cpp
Normal file
|
@ -0,0 +1,75 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Time{
|
||||
// You will need three integer data members to store the hours, minutes, and seconds.
|
||||
int hours;
|
||||
int minutes;
|
||||
int seconds;
|
||||
public:
|
||||
Time(int hours = 0, int minutes = 0, int seconds = 0) : hours(hours), minutes(minutes), seconds(seconds){}
|
||||
Time(const Time& copy){
|
||||
*this = copy;
|
||||
}
|
||||
// Binary Operators
|
||||
// Arithmetic Operators
|
||||
Time operator+(const Time& val) const{
|
||||
Time result;
|
||||
result.seconds = this->seconds + val.seconds;
|
||||
if(result.seconds>=60){
|
||||
result.seconds -= 60;
|
||||
result.minutes++;
|
||||
}
|
||||
result.minutes += this->minutes + val.minutes;
|
||||
if(result.minutes>=60){
|
||||
result.minutes -= 60;
|
||||
result.hours++;
|
||||
}
|
||||
result.hours += this->hours + val.hours;
|
||||
return result;
|
||||
}
|
||||
Time operator-(const Time& val) const{
|
||||
|
||||
// 2h 5m 40s - 1h 2m 50s
|
||||
Time result;
|
||||
result.hours = this->hours - val.hours;
|
||||
result.seconds = this->seconds - val.seconds;
|
||||
if(result.seconds<0){
|
||||
|
||||
}
|
||||
}
|
||||
// Compound Assignment Operators
|
||||
Time operator+=(const Time& rhs){
|
||||
return *this + rhs;
|
||||
}
|
||||
Time operator-=(const Time& rhs){
|
||||
return *this - rhs;
|
||||
}
|
||||
// Logical Operators
|
||||
bool operator==(const Time& val) const{
|
||||
return this->seconds == val.seconds && this->minutes == val.minutes && this->hours == val.hours;
|
||||
}
|
||||
bool operator!=(const Time& val) const{
|
||||
return !(*this == val);
|
||||
}
|
||||
bool operator<(const Time& val) const;
|
||||
bool operator<=(const Time& val) const;
|
||||
bool operator>(const Time& val) const;
|
||||
bool operator>=(const Time& val) const;
|
||||
// Additional Functions
|
||||
Time elapsedTime() const; // Calculate elapsed time
|
||||
~Time(){} // destructor
|
||||
friend std::ostream& operator<<(std::ostream& output, const Time& val); // outputs the Time
|
||||
friend std::istream& operator>>(std::istream& input, Time& val); // inputs the Time
|
||||
};
|
||||
ostream& operator<<(std::ostream& output, const Time& val){
|
||||
output<<"Hours "<<val.hours<<" Minutes "<<val.minutes<<" Seconds "<<val.seconds<<endl;
|
||||
}
|
||||
istream& operator>>(std::istream& input, Time& val){
|
||||
cout<<"Enter Hours: ";
|
||||
input>>val.hours;
|
||||
cout<<"Enter Minutes: ";
|
||||
input>>val.minutes;
|
||||
cout<<"Enter Seconds: ";
|
||||
input>>val.seconds;
|
||||
}
|
68
.config/Code/User/History/1613c77b/uBgV.cpp
Normal file
68
.config/Code/User/History/1613c77b/uBgV.cpp
Normal file
|
@ -0,0 +1,68 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Time{
|
||||
// You will need three integer data members to store the hours, minutes, and seconds.
|
||||
int hours;
|
||||
int minutes;
|
||||
int seconds;
|
||||
public:
|
||||
Time(int hours = 0, int minutes = 0, int seconds = 0) : hours(hours), minutes(minutes), seconds(seconds){}
|
||||
Time(const Time& copy){
|
||||
*this = copy;
|
||||
}
|
||||
// Binary Operators
|
||||
// Arithmetic Operators
|
||||
Time operator+(const Time& val) const{
|
||||
Time result;
|
||||
result.seconds = this->seconds + val.seconds;
|
||||
if(result.seconds>=60){
|
||||
result.seconds -= 60;
|
||||
result.minutes++;
|
||||
}
|
||||
result.minutes += this->minutes + val.minutes;
|
||||
if(result.minutes>=60){
|
||||
result.minutes -= 60;
|
||||
result.hours++;
|
||||
}
|
||||
result.hours += this->hours + val.hours;
|
||||
return result;
|
||||
}
|
||||
Time operator-(const Time& val) const{
|
||||
|
||||
}
|
||||
// Compound Assignment Operators
|
||||
Time operator+=(const Time& rhs){
|
||||
return *this + rhs;
|
||||
}
|
||||
Time operator-=(const Time& rhs){
|
||||
return *this - rhs;
|
||||
}
|
||||
// Logical Operators
|
||||
bool operator==(const Time& val) const{
|
||||
return this->seconds == val.seconds && this->minutes == val.minutes && this->hours == val.hours;
|
||||
}
|
||||
bool operator!=(const Time& val) const{
|
||||
return !(*this == val);
|
||||
}
|
||||
bool operator<(const Time& val) const;
|
||||
bool operator<=(const Time& val) const;
|
||||
bool operator>(const Time& val) const;
|
||||
bool operator>=(const Time& val) const;
|
||||
// Additional Functions
|
||||
Time elapsedTime() const; // Calculate elapsed time
|
||||
~Time(){} // destructor
|
||||
friend std::ostream& operator<<(std::ostream& output, const Time& val); // outputs the Time
|
||||
friend std::istream& operator>>(std::istream& input, Time& val); // inputs the Time
|
||||
};
|
||||
ostream& operator<<(std::ostream& output, const Time& val){
|
||||
output<<"Hours "<<val.hours<<" Minutes "<<val.minutes<<" Seconds "<<val.seconds<<endl;
|
||||
}
|
||||
istream& operator>>(std::istream& input, Time& val){
|
||||
cout<<"Enter Hours: ";
|
||||
input>>val.hours;
|
||||
cout<<"Enter Minutes: ";
|
||||
input>>val.minutes;
|
||||
cout<<"Enter Seconds: ";
|
||||
input>>val.seconds;
|
||||
}
|
60
.config/Code/User/History/1613c77b/vKUk.cpp
Normal file
60
.config/Code/User/History/1613c77b/vKUk.cpp
Normal file
|
@ -0,0 +1,60 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Time{
|
||||
// You will need three integer data members to store the hours, minutes, and seconds.
|
||||
int hours;
|
||||
int minutes;
|
||||
int seconds;
|
||||
public:
|
||||
Time(int hours = 0, int minutes = 0, int seconds = 0) : hours(hours), minutes(minutes), seconds(seconds){}
|
||||
Time(const Time& copy){
|
||||
*this = copy;
|
||||
}
|
||||
// Binary Operators
|
||||
// Arithmetic Operators
|
||||
Time operator+(const Time& val) const{
|
||||
Time result;
|
||||
result.seconds = this->seconds + val.seconds;
|
||||
if(result.seconds>=60){
|
||||
result.seconds -= 60;
|
||||
result.minutes++;
|
||||
}
|
||||
result.minutes += this->minutes + val.minutes;
|
||||
if(result.minutes>=60){
|
||||
result.minutes -= 60;
|
||||
result.hours++;
|
||||
}
|
||||
result.hours += this->hours + val.hours;
|
||||
return result;
|
||||
}
|
||||
Time operator-(const Time& val) const{
|
||||
|
||||
}
|
||||
// Compound Assignment Operators
|
||||
Time operator+=(const Time& rhs){
|
||||
return *this + rhs;
|
||||
}
|
||||
Time operator-=(const Time& rhs){
|
||||
return *this - rhs;
|
||||
}
|
||||
// Logical Operators
|
||||
bool operator==(const Time& val) const{
|
||||
return this->seconds == val.seconds && this->minutes == val.minutes && this->hours == val.hours;
|
||||
}
|
||||
bool operator!=(const Time& val) const{
|
||||
return !(*this == val);
|
||||
}
|
||||
bool operator<(const Time& val) const;
|
||||
bool operator<=(const Time& val) const;
|
||||
bool operator>(const Time& val) const;
|
||||
bool operator>=(const Time& val) const;
|
||||
// Additional Functions
|
||||
Time elapsedTime() const; // Calculate elapsed time
|
||||
~Time(){} // destructor
|
||||
friend std::ostream& operator<<(std::ostream& output, const Time& val); // outputs the Time
|
||||
friend std::istream& operator>>(std::istream& input, Time& val); // inputs the Time
|
||||
};
|
||||
|
||||
|
||||
ostream& operator<<(std::ostream& output, const Time& val); // outputs the Time
|
68
.config/Code/User/History/1613c77b/vT2t.cpp
Normal file
68
.config/Code/User/History/1613c77b/vT2t.cpp
Normal file
|
@ -0,0 +1,68 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Time{
|
||||
// You will need three integer data members to store the hours, minutes, and seconds.
|
||||
int hours;
|
||||
int minutes;
|
||||
int seconds;
|
||||
public:
|
||||
Time(int hours = 0, int minutes = 0, int seconds = 0) : hours(hours), minutes(minutes), seconds(seconds){}
|
||||
Time(const Time& copy){
|
||||
*this = copy;
|
||||
}
|
||||
// Binary Operators
|
||||
// Arithmetic Operators
|
||||
Time operator+(const Time& val) const{
|
||||
Time result;
|
||||
result.seconds = this->seconds + val.seconds;
|
||||
if(result.seconds>=60){
|
||||
result.seconds -= 60;
|
||||
result.minutes++;
|
||||
}
|
||||
result.minutes += this->minutes + val.minutes;
|
||||
if(result.minutes>=60){
|
||||
result.minutes -= 60;
|
||||
result.hours++;
|
||||
}
|
||||
result.hours += this->hours + val.hours;
|
||||
return result;
|
||||
}
|
||||
Time operator-(const Time& val) const{
|
||||
|
||||
}
|
||||
// Compound Assignment Operators
|
||||
Time operator+=(const Time& rhs){
|
||||
return *this + rhs;
|
||||
}
|
||||
Time operator-=(const Time& rhs){
|
||||
return *this - rhs;
|
||||
}
|
||||
// Logical Operators
|
||||
bool operator==(const Time& val) const{
|
||||
return this->seconds == val.seconds && this->minutes == val.minutes && this->hours == val.hours;
|
||||
}
|
||||
bool operator!=(const Time& val) const{
|
||||
return !(*this == val);
|
||||
}
|
||||
bool operator<(const Time& val) const;
|
||||
bool operator<=(const Time& val) const;
|
||||
bool operator>(const Time& val) const;
|
||||
bool operator>=(const Time& val) const;
|
||||
// Additional Functions
|
||||
Time elapsedTime() const; // Calculate elapsed time
|
||||
~Time(){} // destructor
|
||||
friend std::ostream& operator<<(std::ostream& output, const Time& val); // outputs the Time
|
||||
friend std::istream& operator>>(std::istream& input, Time& val); // inputs the Time
|
||||
};
|
||||
ostream& operator<<(std::ostream& output, const Time& val){
|
||||
output<<"Hours "<<val.hours<<" Minutes "<<val.minutes<<" Seconds "<<val.seconds<<endl;
|
||||
}
|
||||
istream& operator>>(std::istream& input, Time& val){
|
||||
cout<<"Enter Hours: ";
|
||||
input>>val.hours;
|
||||
cout<<"Enter Minutes: ";
|
||||
input>>val.minutes;
|
||||
cout<<"Enter Seconds: ";
|
||||
input>>val.seconds;
|
||||
}
|
45
.config/Code/User/History/1613c77b/vYNq.cpp
Normal file
45
.config/Code/User/History/1613c77b/vYNq.cpp
Normal file
|
@ -0,0 +1,45 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Time{
|
||||
// You will need three integer data members to store the hours, minutes, and seconds.
|
||||
int hours;
|
||||
int minutes;
|
||||
int seconds;
|
||||
public:
|
||||
Time(int hours = 0, int minutes = 0, int seconds = 0) : hours(hours), minutes(minutes), seconds(seconds){}
|
||||
Time(const Time& copy){
|
||||
*this = copy;
|
||||
}
|
||||
// Binary Operators
|
||||
// Arithmetic Operators
|
||||
Time operator+(const Time& val) const{
|
||||
Time result;
|
||||
result.seconds = this->seconds + val.seconds;
|
||||
if(result.seconds>=60){
|
||||
result.seconds -= 60;
|
||||
result.minutes++;
|
||||
}
|
||||
result.minutes += this->minutes + val.minutes;
|
||||
if(result.minutes>=60){
|
||||
result.minutes -= 60;
|
||||
result.hours++;
|
||||
}
|
||||
}
|
||||
Time operator-(const Time& val) const;
|
||||
// Compound Assignment Operators
|
||||
Time& operator+=(const Time& rhs);
|
||||
Time& operator-=(const Time& rhs);
|
||||
// Logical Operators
|
||||
bool operator==(const Time& val) const;
|
||||
bool operator!=(const Time& val) const;
|
||||
bool operator<(const Time& val) const;
|
||||
bool operator<=(const Time& val) const;
|
||||
bool operator>(const Time& val) const;
|
||||
bool operator>=(const Time& val) const;
|
||||
// Additional Functions
|
||||
Time elapsedTime() const; // Calculate elapsed time
|
||||
~Time(); // destructor
|
||||
friend std::ostream& operator<<(std::ostream& output, const Time& val); // outputs the Time
|
||||
friend std::istream& operator>>(std::istream& input, Time& val); // inputs the Time
|
||||
};
|
79
.config/Code/User/History/1613c77b/xrdb.cpp
Normal file
79
.config/Code/User/History/1613c77b/xrdb.cpp
Normal file
|
@ -0,0 +1,79 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Time{
|
||||
// You will need three integer data members to store the hours, minutes, and seconds.
|
||||
int hours;
|
||||
int minutes;
|
||||
int seconds;
|
||||
public:
|
||||
Time(int hours = 0, int minutes = 0, int seconds = 0) : hours(hours), minutes(minutes), seconds(seconds){}
|
||||
Time(const Time& copy){
|
||||
*this = copy;
|
||||
}
|
||||
// Binary Operators
|
||||
// Arithmetic Operators
|
||||
Time operator+(const Time& val) const{
|
||||
Time result;
|
||||
result.seconds = this->seconds + val.seconds;
|
||||
if(result.seconds>=60){
|
||||
result.seconds -= 60;
|
||||
result.minutes++;
|
||||
}
|
||||
result.minutes += this->minutes + val.minutes;
|
||||
if(result.minutes>=60){
|
||||
result.minutes -= 60;
|
||||
result.hours++;
|
||||
}
|
||||
result.hours += this->hours + val.hours;
|
||||
return result;
|
||||
}
|
||||
Time operator-(const Time& val) const{
|
||||
|
||||
// 2h 1m 40s - 1h 2m 50s
|
||||
// 49m 50s
|
||||
Time result;
|
||||
result.hours = this->hours - val.hours;
|
||||
if(result.hours<0) result.hours *= -1;
|
||||
result.minutes = this->minutes - val.minutes;
|
||||
|
||||
result.seconds = this->seconds - val.seconds;
|
||||
if(result.seconds<0){
|
||||
|
||||
}
|
||||
}
|
||||
// Compound Assignment Operators
|
||||
Time operator+=(const Time& rhs){
|
||||
return *this + rhs;
|
||||
}
|
||||
Time operator-=(const Time& rhs){
|
||||
return *this - rhs;
|
||||
}
|
||||
// Logical Operators
|
||||
bool operator==(const Time& val) const{
|
||||
return this->seconds == val.seconds && this->minutes == val.minutes && this->hours == val.hours;
|
||||
}
|
||||
bool operator!=(const Time& val) const{
|
||||
return !(*this == val);
|
||||
}
|
||||
bool operator<(const Time& val) const;
|
||||
bool operator<=(const Time& val) const;
|
||||
bool operator>(const Time& val) const;
|
||||
bool operator>=(const Time& val) const;
|
||||
// Additional Functions
|
||||
Time elapsedTime() const; // Calculate elapsed time
|
||||
~Time(){} // destructor
|
||||
friend std::ostream& operator<<(std::ostream& output, const Time& val); // outputs the Time
|
||||
friend std::istream& operator>>(std::istream& input, Time& val); // inputs the Time
|
||||
};
|
||||
ostream& operator<<(std::ostream& output, const Time& val){
|
||||
output<<"Hours "<<val.hours<<" Minutes "<<val.minutes<<" Seconds "<<val.seconds<<endl;
|
||||
}
|
||||
istream& operator>>(std::istream& input, Time& val){
|
||||
cout<<"Enter Hours: ";
|
||||
input>>val.hours;
|
||||
cout<<"Enter Minutes: ";
|
||||
input>>val.minutes;
|
||||
cout<<"Enter Seconds: ";
|
||||
input>>val.seconds;
|
||||
}
|
50
.config/Code/User/History/1613c77b/ywQu.cpp
Normal file
50
.config/Code/User/History/1613c77b/ywQu.cpp
Normal file
|
@ -0,0 +1,50 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Time{
|
||||
// You will need three integer data members to store the hours, minutes, and seconds.
|
||||
int hours;
|
||||
int minutes;
|
||||
int seconds;
|
||||
public:
|
||||
Time(int hours = 0, int minutes = 0, int seconds = 0) : hours(hours), minutes(minutes), seconds(seconds){}
|
||||
Time(const Time& copy){
|
||||
*this = copy;
|
||||
}
|
||||
// Binary Operators
|
||||
// Arithmetic Operators
|
||||
Time operator+(const Time& val) const{
|
||||
Time result;
|
||||
result.seconds = this->seconds + val.seconds;
|
||||
if(result.seconds>=60){
|
||||
result.seconds -= 60;
|
||||
result.minutes++;
|
||||
}
|
||||
result.minutes += this->minutes + val.minutes;
|
||||
if(result.minutes>=60){
|
||||
result.minutes -= 60;
|
||||
result.hours++;
|
||||
}
|
||||
result.hours += this->hours + val.hours;
|
||||
}
|
||||
Time operator-(const Time& val) const{
|
||||
|
||||
}
|
||||
// Compound Assignment Operators
|
||||
Time& operator+=(const Time& rhs){
|
||||
return (*this) + rhs;
|
||||
}
|
||||
Time& operator-=(const Time& rhs);
|
||||
// Logical Operators
|
||||
bool operator==(const Time& val) const;
|
||||
bool operator!=(const Time& val) const;
|
||||
bool operator<(const Time& val) const;
|
||||
bool operator<=(const Time& val) const;
|
||||
bool operator>(const Time& val) const;
|
||||
bool operator>=(const Time& val) const;
|
||||
// Additional Functions
|
||||
Time elapsedTime() const; // Calculate elapsed time
|
||||
~Time(); // destructor
|
||||
friend std::ostream& operator<<(std::ostream& output, const Time& val); // outputs the Time
|
||||
friend std::istream& operator>>(std::istream& input, Time& val); // inputs the Time
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue