Witam!
Dziwny kominukat dostałem dzisiaj od kompilatora w związku z wpisaniem danych do tablicy, mianowicie: cannot bind 'std::istream {aka std::basic_istream<char>}' lvalue to 'std::basic_istream<char>&&'|
Konkretnie chodzi o fragment: cin >> dates[i]; i cin >> bottles[i];
Nie za bardzo rozumiem w czym tkwi problem :/
Kod:
#ifndef WINEC_H_INCLUDED
#define WINEC_H_INCLUDED
#include <iostream>
#include <valarray>
#include <string>
using namespace std;
typedef valarray<int> ArrayInt;
typedef pair<ArrayInt, ArrayInt> PairArray;
class Wine
{
private:
string label;
int years;
PairArray year_n_amount;
int dates[];
int bottles[];
public:
Wine() : label("brak"), years(0), year_n_amount() {}
Wine(const string & l, int y, const int yr[], const int bot[]);
Wine(const string & l, int y) : label(l), years(y) {}
void GetBottles() const;
void Show() const;
const string & Label() const;
int sum();
};
Wine::Wine(const string & l, int y, const int yr[], const int bot[])
{
label = l;
years = y;
dates[y] = yr[y];
bottles[y] = bot[y];
}
void Wine::GetBottles() const
{
cout << "Podaj dane o winie " << label << " dla " << years << " rocznikow: ";
for(int i = 0; i < years; i++)
{
cout << "Podaj rocznik: ";
cin >> dates[i];
cout << "Podaj liczbe butelelek: ";
cin >> bottles[i];
}