NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

1. // main.cpp

2. #include <utility>

3. #include "postal.h"

4. #include "postal.h"

5. using namespace sdds;

6.

7. int main()

B. (

9.

Person people [num];

10.

people [0] = Person ("Aqua");

11. people [1] Person("Towa");

12.

people [2] = Person ("Astel");

13.

Postaloffice po1("Toronto");

14.

15. for (int i = 0; i < num; ++i) {

16. pol.sendmail(people[i], people [num - 1 - i), mailType::letter);

17.

18.

19.

pol.listmail();

20.

Postaloffice po2 std::move (pol);

21.

22.

pol.sendmail(people[num - 1 1], people[i], mailType::parcel);

23. for (int i = 0; i < num; ++i)


24.

25.

po2.receiveMail (people[i]);

26.

po2.listMail();

27. }

1. // postal.h

2. #ifndef SDDS_POSTAL_H

3. #define SDDS_POSTAL_H

4. #include <string>

5.

6. constexpr int capacity = 5 * 2;

7. extern const int num;

8.

9. namespace sdds.

10. (

11.

12.

13.

14.

enum class mailType (letter, parcel, none };

class Postaloffice;

15. class Person (

16. std::string name {};

17. public:
15.

class Person (

16. std::string name();

17.

public:

Person(const char nm): name (nm) ();

18.

19.

operator std::string() const { return name; );

20. };

21.

22.

class Postaloffice

(

23.

24.

struct Mail (

25.

Person sender( "Noone" );

26.

Person receiver( "Noone" );

27.

mailType mtype( mailType::none);

28.

};

29.

char location();

30.

31.

int amount of Mail();

Mail mail[capacity]();

32.

33.

34.

public:

Postaloffice()();

35.

36.

Postaloffice(const char* 10);

37.

-Postaloffice();

38. Postaloffice(const Postaloffice& src) = delete;

15.

class Person (

16. std::string name();

17.

public:

Person(const char nm): name (nm) ();

18.

19.

operator std::string() const { return name; );

20. };

21.

22.

class Postaloffice

(

23.

24.

struct Mail (

25.

Person sender( "Noone" );

26.

Person receiver( "Noone" );

27.

mailType mtype( mailType::none);

28.

};

29.

char location();

30.

31.

int amount of Mail();

Mail mail[capacity]();

32.

33.

34.

public:

Postaloffice()();

35.

36.

Postaloffice(const char* 10);

37.

-Postaloffice();

38. Postaloffice(const Postaloffice& src) = delete;
26.

Person receiver { "Noone" };

27.

mailType mtype{ mailType::none};

28.

};

29.

char location{};

30.

int amountofMail{};

31.

Mail mail[capacity]{};

32.

33.

34.

public:

35.

Postaloffice(){};

36.

Postaloffice (const char* 10);

37.

-Postaloffice();

38.

Postaloffice(const Postaioffice& src) = delete;

39. Postaloffice& operator= (const Postaloffice& src) = delete;

30. Postaloffice (Postaloffice &&src);

41. Postaloffice& operator= (Postaloffice&& src);

42. void sendMail (const Person& sender, const Person& receiver, mailType mt);

43. void receiveMail (const Person& receiver);

44. void listMail(std::ostream& os= std::cout) const;

45. };

46. )

47, endif



1postal.cpp

#include <cstring>

#include <utility>

#include

#include <iostream>

#include "postal.h"

8. const int num

Postaloffice::Postaloffice(const char

11.

(loc)

location = char[std::strien (loc)+1];

std::strcpy(location, loc);

15.

PostalOffice::-PostalOffice(){

19.)

PostalOffice::PostalOffice(PostalOffice&& src)

22.

this src;

delete[] location;

23.
21. PostalOffice::PostalOffice(PostalOffice&& src) (*

22. this = src;

23. )

24.

25. Postaloffice& Postaloffice::operator=(Postaloffice&& src)

26.

if(this != &src){

27.

delete [] location;

location src.location;

28.

amount ofMail src.amountofmail;

for (int i = 0; i < capacity; ++i)

29.

30.

31.

mail[i] = src.mail[i];

32.

src.location = nullptr;

33. )

34. return this;

35. )

36.

37. void Postaloffice::sendMail(const Person& sender, const Persons receiver, mailType mt){

38.

if (amount ofmail < capacity) {

39. mail[amount ofMail].sender sender;

30.

mail[amount of mail].mtype= mt;

41.

amountofail++;

{

42.

43.

44. )

mail [amountofmail]. receiver = receiver;

145

46. void Postaloffice::receiveMail(const Person& receiver) (

47.

for (auto& m: mail) {

if (e.receiver receiver){

48.

m = Mail();

49.

amountofMail--;

50.

51.

52. }

53.)

54.

55. void PostalOffice::listMail(std::ostream& os) const {

56.

os<< "Postaloffice-" << location << "n";

57.

os << "Total mail:" << amount ofMail <<"n";

58.

for (int i = 0; i < <mountofMail; ++i) {

59.

os << "#" << (i+1) << "";

60.

if (mail[i].mtype == mailType::letter)

61.

os << "Letter";

else if (mail[i].mtype == mailType: :parcel)

62.

63.

os << "Parcel";

64.

else

os << "Nothing";

65.

66. 05 << To:" << (std::string)mail[1].receiver << "n";

67. }

68. }
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.