This repository has been archived on 2024-08-23. You can view files and clone it, but cannot push or open issues or pull requests.
lessons/C++/lesson7/task1.cpp
2023-07-16 13:23:25 +00:00

31 lines
592 B
C++

#include <iostream>
#include <string>
struct Good {
std::string name;
unsigned cost;
unsigned amount;
Good(std::string name, unsigned cost, unsigned amount) {
this->name = name;
this->cost = cost;
this->amount = amount;
}
void information() {
std::cout << '(' << name << ',' << cost << ',' << amount
<< ")\n";
}
void changeCost(unsigned cost) {
this->cost = cost;
}
};
int main() {
Good apple("Apple", 10, 20);
apple.information();
apple.changeCost(20);
apple.information();
}