Skip to content

Instantly share code, notes, and snippets.

@Soulstorm50
Created June 12, 2016 18:59
Show Gist options
  • Save Soulstorm50/b3e29268295dc94b90dad2fd4cd90b3e to your computer and use it in GitHub Desktop.
Save Soulstorm50/b3e29268295dc94b90dad2fd4cd90b3e to your computer and use it in GitHub Desktop.
#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