Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- using namespace std;
- struct NOTE{
- char * NAME;
- char * TELE;
- int BDAY[3];
- };
- class Data{
- public:
- NOTE * BLOCKNOTE;
- Data(){
- BLOCKNOTE = new NOTE[8];
- }
- NOTE get(int num){
- return BLOCKNOTE[num];
- }
- void set(int num, char * NAME, char * TELE, int day, int month, int year){
- BLOCKNOTE[num].NAME = NAME;
- BLOCKNOTE[num].TELE = TELE;
- BLOCKNOTE[num].BDAY[0] = day;
- BLOCKNOTE[num].BDAY[1] = month;
- BLOCKNOTE[num].BDAY[2] = year;
- }
- void enter_data(){
- cout << "Enter 8 elements: \n";
- for (int i = 0; i < 8; i++){
- cout << "[+] Element #" << i<< "\n";
- cout << "Name: ";
- cin >> BLOCKNOTE[i].NAME;
- cout << "\nPhone: ";
- cin >> BLOCKNOTE[i].TELE;
- cout << "\nBirthday: Day:";
- cin >> BLOCKNOTE[i].BDAY[0];
- cout << ", month: ";
- cin >> BLOCKNOTE[i].BDAY[1];
- cout << ", year: ";
- cin >> BLOCKNOTE[i].BDAY[2];
- }
- }
- void find_birthday(int month){
- int count = 0;
- for (int i = 0; i < 8; i++){
- if (BLOCKNOTE[i].BDAY[1] == month){
- count++;
- cout << "Name: " << BLOCKNOTE[i].NAME << "Birthday: " << BLOCKNOTE[i].BDAY[0] << "." << BLOCKNOTE[i].BDAY[1] << "." << BLOCKNOTE[i].BDAY[2];
- cout << " Phone: " << BLOCKNOTE[i].TELE << "\n";
- }
- }
- if (count == 0)
- cout << "Nothing found.\n";
- }
- };
- void main(){
- Data data;
- data.enter_data();
- data.find_birthday(2);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement