Advertisement
rado_dimitrov66

Untitled

Nov 29th, 2023
584
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.03 KB | None | 0 0
  1. #include <iomanip>
  2. #include <cmath>
  3. #include <iostream>
  4.  
  5. using namespace std;
  6.  
  7. struct Laptop
  8. {
  9.  
  10.     char Model[11];
  11.     char Marka[11];
  12.     char Color[9];
  13.     char age[5];
  14.     char SerialNumber[5];
  15.     double Inches;
  16.     double Price;
  17. };
  18.  
  19. double Reshenie(double Price) {
  20.  
  21.     double EndPrice = 0;
  22.  
  23.     if ((Price <= 500) && (Price >= 700)) {
  24.  
  25.         EndPrice = 0.02;
  26.     }
  27.     else {
  28.         cout << "Cenata Zapochva ot 500lv.";
  29.     }
  30.     if (Price >= 701 && Price <= 900) {
  31.  
  32.         EndPrice = 0.035;
  33.     }
  34.     else if (Price >= 901 && Price <= 1000) {
  35.  
  36.         EndPrice = 0.05;
  37.     }
  38.     else if (Price >= 1001) {
  39.  
  40.         EndPrice = 0.062;
  41.     }
  42.  
  43.     return EndPrice;
  44.  
  45.  
  46. }
  47.  
  48. int main() {
  49.  
  50.     Laptop M1, M2, M3, M4, M5;
  51.  
  52.     cout << "Laptop 1 model: ";
  53.     cin.getline(M1.Model, 11);
  54.  
  55.     cout << "Laptop 1 brand: ";
  56.     cin.getline(M1.Marka, 11);
  57.  
  58.     cout << "Laptop 1 color: ";
  59.     cin.getline(M1.Color, 9);
  60.  
  61.     cout << "Laptop 1 year of made: ";
  62.     cin.getline(M1.age, 5);
  63.  
  64.     cout << "Laptop 1 last four numbers of serial number: ";
  65.     cin.getline(M1.SerialNumber, 5);
  66.  
  67.     cout << "Laptop 1 Inches: ";
  68.     cin >> M1.Inches;
  69.  
  70.     cout << "Laptop 1 price: ";
  71.     cin >> M1.Price;
  72.  
  73.     cin.ignore();
  74.  
  75.     cout << "" << endl;
  76.     cout << "Laptop 2 model: ";
  77.     cin.getline(M2.Model, 11);
  78.  
  79.     cout << "Laptop 2 brand: ";
  80.     cin.getline(M2.Marka, 11);
  81.  
  82.     cout << "Laptop 2 color: ";
  83.     cin.getline(M2.Color, 9);
  84.  
  85.     cout << "Laptop 2 year of made: ";
  86.     cin.getline(M2.age, 5);
  87.  
  88.     cout << "Laptop 2 last four numbers of serial number: ";
  89.     cin.getline(M2.SerialNumber, 5);
  90.  
  91.     cout << "Laptop 2 Inches: ";
  92.     cin >> M2.Inches;
  93.  
  94.     cout << "Laptop 2 price[lv.]: ";
  95.     cin >> M2.Price;
  96.  
  97.     cin.ignore();
  98.  
  99.     cout << "" << endl;
  100.     cout << "Laptop 3 model: ";
  101.     cin.getline(M3.Model, 11);
  102.  
  103.     cout << "Laptop 3 brand: ";
  104.     cin.getline(M3.Marka, 11);
  105.  
  106.     cout << "Laptop 3 color: ";
  107.     cin.getline(M3.Color, 9);
  108.  
  109.     cout << "Laptop 3 year of made: ";
  110.     cin.getline(M3.age, 5);
  111.  
  112.     cout << "Laptop 3 last four numbers of serial number: ";
  113.     cin.getline(M3.SerialNumber, 5);
  114.  
  115.     cout << "Laptop 3 Inches: ";
  116.     cin >> M3.Inches;
  117.  
  118.     cout << "Laptop 3 price[lv.]: ";
  119.     cin >> M3.Price;
  120.  
  121.     cin.ignore();
  122.  
  123.     cout << "" << endl;
  124.     cout << "Laptop 4 model: ";
  125.     cin.getline(M4.Model, 11);
  126.  
  127.     cout << "Laptop 4 brand: ";
  128.     cin.getline(M4.Marka, 11);
  129.  
  130.     cout << "Laptop 4 color: ";
  131.     cin.getline(M4.Color, 9);
  132.  
  133.     cout << "Laptop 4 year of made: ";
  134.     cin.getline(M4.age, 5);
  135.  
  136.     cout << "Laptop 4 last four numbers of serial number: ";
  137.     cin.getline(M4.SerialNumber, 5);
  138.  
  139.     cout << "Laptop 4 Inches: ";
  140.     cin >> M4.Inches;
  141.  
  142.     cout << "Laptop 4 price[lv.]: ";
  143.     cin >> M4.Price;
  144.  
  145.     cin.ignore();
  146.  
  147.     cout << "" << endl;
  148.     cout << "Laptop 5 model: ";
  149.     cin.getline(M5.Model, 11);
  150.  
  151.     cout << "Laptop 5 brand: ";
  152.     cin.getline(M5.Marka, 11);
  153.  
  154.     cout << "Laptop 5 color: ";
  155.     cin.getline(M5.Color, 9);
  156.  
  157.     cout << "Laptop 5 year of made: ";
  158.     cin.getline(M5.age, 5);
  159.  
  160.     cout << "Laptop 5 last four numbers of serial number: ";
  161.     cin.getline(M5.SerialNumber, 5);
  162.  
  163.     cout << "Laptop 5 Inches: ";
  164.     cin >> M5.Inches;
  165.  
  166.     cout << "Laptop 5 price[lv.]: ";
  167.     cin >> M5.Price;
  168. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement