NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

Carte, fisa:

#include <iostream>
#include<iostream>
#include<string.h>
#include<stdio.h>
using namespace std;
// definirea clasei de baza carte
class carte
{
public:
carte(char *nume)
{
strcpy(carte::nume, nume);
};
void afisaza_nume()
{
cout<<"n Titlul cartii:"<<nume<<endl;
};
private:
char nume[40];
};
// definirea clasei derivate FisaLibrarie
class FisaLibrarie: public carte
{
public:
FisaLibrarie(char *nume, char *aut1, char *aut2, char *ed, int *np, double *p):carte(nume)
{
strcpy(FisaLibrarie ::autor1, aut1) ;
strcpy(FisaLibrarie ::autor2, aut2) ;
strcpy(FisaLibrarie ::editura, ed) ;
FisaLibrarie ::nrpag=*np ;
FisaLibrarie ::pret=*p ;
};
void afisaza_Libraria()
{
cout<<"n Lista cartilor din librarie:"<<endl;
cout<<"n ===================================="<<endl;
afisaza_nume() ;
cout <<"n numele autorului: "<<autor1;
cout <<"n prenumele autorului: "<<autor2;
cout <<"n editura: "<<editura;
cout <<"n nr de pagini: "<<nrpag;
cout <<"n pretul cartii: "<<pret;
cout<<"n ===================================="<<endl;
};

Restaurant:

#include <iostream>
#include <string>
#include <list>
#include <map>
using namespace std;

class Menu{
public:
string name;
float price;
Menu(string namee)
{
name = namee;
}
Menu()
{
name = "/0";
}
};

class Restaurant{
public:
int const open = 8;
int const closed = 23;
string address;
string name;
Menu *m;
Restaurant(string add,string namee,Menu *m1){
address = add;
name = namee;
m = m1;
}
Restaurant(){
address = "/0";
name = "/0";
}
friend std::ostream& operator <<(std::ostream&,Restaurant&);
friend std::istream& operator >>(std::istream&,Restaurant&);
};
list<Restaurant> rList;

class Bistro: public Restaurant
{
bool open;
Bistro(string address,string name,Menu *m1,bool o) : Restaurant(address,name,m1){
open = o;
}
};

void addList(Restaurant& r){
rList.insert(rList.end(),r);
}

void printList()
{
list<Restaurant>::iterator *it;
for(*it = rList.begin(); *it != rList.end(); *it++)
{
//cout << *it->name;
}
}
std::map<Menu*,Restaurant*> rMap;
int main()
{
Menu *m2 = new Menu("menu1");
Menu *m1 = new Menu("menu2");
Restaurant *r = new Restaurant("Talia","Str.Ion",m1);
Restaurant *r1 = new Restaurant("Pizza","Str.Ion",m2);
cout << *r << endl;
cout<< *r1;
addList(*r);
addList(*r1);
rMap[m1] = r;
rMap[m2] = r1;
list<Restaurant>::iterator *it;
delete m2;
delete m1;
delete r;
delete r1;
return 0;
}

std::ostream& operator <<(std::ostream& o,Restaurant& r)
{
o << r.name << "," << r.address;
return o;
}

std::istream& operator >>(std::istream& i,Restaurant& r)
{
cout << "nume:";
i >> r.name;
cout << "nadresa:";
i >> r.address;
return i;
}

Add to list:

#include <iostream>
#include <list>
#include <cstring>
using namespace std;

class MyClass {
int a, b;
int sum;
public:
MyClass() {
a = b = 0;
}
MyClass(int i, int j) {
a = i;
b = j;
sum = a + b;
}
int getsum() {
return sum;
}

friend bool operator<(const MyClass &o1,const MyClass &o2);
friend bool operator>(const MyClass &o1,const MyClass &o2);
friend bool operator==(const MyClass &o1,const MyClass &o2);
friend bool operator!=(const MyClass &o1,const MyClass &o2);
};

bool operator<(const MyClass &o1, const MyClass &o2)
{
return o1.sum < o2.sum;
}

bool operator>(const MyClass &o1, const MyClass &o2)
{
return o1.sum > o2.sum;
}

bool operator==(const MyClass &o1, const MyClass &o2)
{
return o1.sum == o2.sum;
}

bool operator!=(const MyClass &o1, const MyClass &o2)
{
return o1.sum != o2.sum;
}

int main()
{
list<MyClass> lst1;
for(int i=0; i<10; i++) lst1.push_back(MyClass(i, i));

cout << "First list: ";
list<MyClass>::iterator p = lst1.begin();
while(p != lst1.end()) {
cout << p->getsum() << " ";
p++;
}
cout << endl;

// create a second list
list<MyClass> lst2;
for(int i=0; i<10; i++) lst2.push_back(MyClass(i*2, i*3));

cout << "Second list: ";
p = lst2.begin();
while(p != lst2.end()) {
cout << p->getsum() << " ";
p++;
}
cout << endl;

lst1.merge(lst2);

cout << "Merged list: ";
p = lst1.begin();
while(p != lst1.end()) {
cout << p->getsum() << " ";
p++;
}

return 0;
}
     
 
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.