#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;
class MyClass {
int value;
public:
MyClass() { value = 0; }
MyClass(int x) { value = x; }
MyClass &operator=(int x) {
value = x; return *this;
}
double get_value() { return value; }
};
bool operator<(MyClass a, MyClass b)
{
return a.get_value() < b.get_value();
}
bool operator==(MyClass a, MyClass b)
{
return a.get_value() == b.get_value();
}
int main()
{
vector<MyClass> v;
for(int i=0; i<7; i++)
v.push_back(MyClass(60 + rand()0));
cout << "Farenheit valueeratures:\n";
for(int i=0; i<v.size(); i++)
cout << v[i].get_value() << " ";
cout << endl;
for(int i=0; i<v.size(); i++)
v[i] = (int) (v[i].get_value()-32) * 5/9 ;
cout << "Centigrade valueeratures:\n";
for(int i=0; i<v.size(); i++)
cout << v[i].get_value() << " ";
return 0;
}
/*
Farenheit valueeratures:
71 77 64 70 89 64 78
Centigrade valueeratures:
21 25 17 21 31 17 25
*/
|