Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- class Note {
- string format;
- int pages;
- public:
- Note(string format = "", int pages = 0) {
- this->format = format;
- this->pages = pages;
- }
- string GetFormat() {
- return format;
- }
- ~Note() {}
- void print() {
- cout << "Format: " << format << endl;
- cout << "Pages: " << pages << endl;
- }
- };
- void printLineNotes(Note arr[], int size) {
- cout << "Line notes: " << endl;
- for (int i = 0; i < size; i++) {
- if (arr[i].GetFormat() == "line") {
- arr[i].print();
- }
- }
- }
- int main() {
- const int size = 3;
- Note notes[size] = { Note("line", 100),
- Note("cell", 50),
- Note("line", 200) };
- printLineNotes(notes, size);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment