class State
This commit is contained in:
1 file changed
+24
@@ -4,6 +4,30 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
class State {
|
||||||
|
public:
|
||||||
|
string name;
|
||||||
|
string capital;
|
||||||
|
string language;
|
||||||
|
long population;
|
||||||
|
double area;
|
||||||
|
|
||||||
|
State() : name(""), capital(""), language(""), population(0), area(0.0) {}
|
||||||
|
State(string n, string c, string l, long p, double a)
|
||||||
|
: name(n), capital(c), language(l), population(p), area(a) {}
|
||||||
|
|
||||||
|
friend ostream& operator<<(ostream& os, const State& state) {
|
||||||
|
os << "State: " << state.name << ", Capital: " << state.capital
|
||||||
|
<< ", Language: " << state.language << ", Population: " << state.population
|
||||||
|
<< ", Area: " << state.area;
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator==(const State& other) const {
|
||||||
|
return name == other.name;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
class Element {
|
class Element {
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
Reference in new issue
Block a user