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:       double next_price;
25:       cout << "Please enter the price: ";
26:       cin >> next_price;
27:       prices.push_back(next_price);
28:       int next_score;
29:       cout << "Please enter the score: ";
30:       cin >> next_score;
31:       scores.push_back(next_score);
32:       string remainder; /* read remainder of line */
33:       getline(cin, remainder); 
34: 
35:       if (next_score / next_price > best_score / best_price)
36:       {  
37:          best_index = names.size() - 1;
38:          best_score = next_score;
39:          best_price = next_price;
40:       }     
41: 
42:       cout << "More data? (y/n) ";
43:       string answer;
44:       getline(cin, answer);
45:       if (answer != "y") more = false;
46:    }
47: 
48:    for (int i = 0; i < names.size(); i++)
49:    {
50:       if (i == best_index) cout << "best value => ";
51:       cout << names[i]
52:          << " Price: " << prices[i]
53:          << " Score: " << scores[i] << "\n";
54:    }
55: 
56:    return 0;
57: }