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