01: #include <iostream>
02: #include <string>
03: #include <vector>
04: 
05: using namespace std;
06: 
07: int main()
08: {  
09:    vector<string> names;
10:    vector<double> prices;
11:    vector<int> scores;
12: 
13:    double best_price = 1;
14:    int best_score = 0;
15:    int best_index = -1;
16: 
17:    bool more = true;
18:    while (more)
19:    {  
20:       string next_name;
21:       cout << "Please enter the model name: ";
22:       getline(cin, next_name);
23:       names.push_back(next_name);
24:
25:       double next_price;
26:       cout << "Please enter the price: ";
27:       cin >> next_price;
28:       prices.push_back(next_price);
29:
30:       int next_score;
31:       cout << "Please enter the score: ";
32:       cin >> next_score;
33:       scores.push_back(next_score);
34:
35:       string remainder; /* read remainder of line */
36:       getline(cin, remainder); 
37: 
38:       if (next_score / next_price > best_score / best_price)
39:       {  
40:          best_index = names.size() - 1;
41:          best_score = next_score;
42:          best_price = next_price;
43:       }     
44: 
45:       cout << "More data? (y/n) ";
46:       string answer;
47:       getline(cin, answer);
48:       if (answer != "y") more = false;
49:    }
50: 
51:    for (int i = 0; i < names.size(); i++)
52:    {
53:       if (i == best_index) cout << "best value => ";
54:       cout << names[i]
55:          << " Price: " << prices[i]
56:          << " Score: " << scores[i] << "\n";
57:    }
58: 
59:    return 0;
60: }