Created
June 12, 2016 18:59
-
-
Save Soulstorm50/b3e29268295dc94b90dad2fd4cd90b3e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
class Plant //класс растение | |
{ | |
public: // модификатор доступа | |
char* kind; //разновидность | |
char* colour; // цвет | |
double weight; //вес | |
int visota; //высота | |
bool polito; //полито или нет | |
// методы: | |
void polit() //метод полить | |
{ | |
if (polito == true) | |
cout << "Полив не требуется для растения " << kind << "\n"; | |
else | |
cout <<"Вы поливаете растение "<< kind << "\n"; | |
} | |
void sniffplant() //метод понюхать растение | |
{ | |
cout << "Нюхать растрение "<< kind << "\n"; | |
} | |
}; | |
void main() | |
{ | |
setlocale(0, "RUS"); | |
Plant P; | |
P.kind = "орхидея"; | |
P.colour = "орхидея"; | |
P.weight = 0.4; | |
P.visota = 15; | |
P.polito = true; | |
P.polit(); | |
P.sniffplant(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment