-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProdus.cpp
More file actions
47 lines (35 loc) · 869 Bytes
/
Copy pathProdus.cpp
File metadata and controls
47 lines (35 loc) · 869 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include "Produs.h"
int Produs::nextId = 100;
Produs::Produs(string d, int nr, double p)
{
denumire=d;
nr_produse=nr;
pret_brut=p;
id_unic=nextId;
nextId++;
}
istream& operator>>(istream& dev,Produs& p)
{
cout<<"Denumire produs: "<<endl;
dev>>p.denumire;
cout<<"Numar de produse: "<<endl;
dev>>p.nr_produse;
cout<<"Pret: "<<endl;
dev>>p.pret_brut;
p.id_unic=p.nextId;
p.nextId++;
return dev;
}
bool Produs::cautareProdus(string n, int i)
{
//Problema rezolvata: case sensitive
string copie_Nume=denumire;
transform(copie_Nume.begin(), copie_Nume.end(), copie_Nume.begin(), ::tolower);
transform(n.begin(), n.end(), n.begin(), ::tolower);
if(copie_Nume==n || id_unic==i)
{
return 0;
}
else
return 1;
}