// Using data structures with vectors
#include <iostream>
#include <vector>
using namespace std;

struct fruit {
  string origin;
  double weight;
  int price;
};

int main() {
  int n;
  cout << "How many fruits? ";
  cin >> n;

  // Define a vector whose elemements have type "fruit"
  vector<fruit> f(n);

  for(unsigned int i=0; i<f.size(); i++){
    cout << "Origin of fruit " << i+1 << "? "; cin >> f[i].origin;
    cout << "Price  of fruit " << i+1 << "? "; cin >> f[i].price;
    cout << "Weight of fruit " << i+1 << "? "; cin >> f[i].weight;
    cout << endl;
  }

  for(unsigned int i=0; i<f.size(); i++)
    cout << "Total price of fruit " << i+1 << " is "
         << f[i].weight * f[i].price << endl;
}
