Advertisement
IlincaMuresan

pret telefoane

Feb 17th, 2020
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. #include<iostream>
  2. #include<cstring>
  3. using namespace std;
  4. struct telefon
  5. {
  6. double pret;
  7. char nume[50];
  8.  
  9. };
  10. struct telefon x,y;
  11. int main()
  12. {
  13. cin>>x.nume>>x.pret;
  14. cin>>y.nume>>y.pret;
  15. if(x.pret>y.pret)
  16. {
  17. cout<<"Cel mai scump telefon este:"<<x.nume<<endl;
  18. }
  19.  
  20. if(x.pret<y.pret)
  21. {
  22. cout<<"Cel mai ieftin telefon este:"<<x.nume<<endl;
  23.  
  24. }
  25. if(y.pret>x.pret)
  26. {
  27. cout<<"Cel mai scump telefon este:"<<y.nume<<endl;
  28. }
  29. if(y.pret<x.pret)
  30. {
  31. cout<<"Cel mai ieftin telefon este:"<<y.nume
  32.  
  33. }
  34.  
  35. if(y.pret==x.pret)
  36. {
  37. cout<<"Telefoanele au acelasi pret";
  38.  
  39. }
  40. return 0;
  41.  
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement