#include <iostream>
#include <string>
#include <vector>
using namespace std;
const int NUM = 5;
int main()
{
vector<int> ratings[NUM];
vector<string> titles[NUM];
int i;
cout << "Wpisz tytuly oraz oceny filmow zgodnie z poleceniem" << endl;
for(i=0; i<NUM; i++)
{
cout << "Wpisz tytul oraz ocene filmu numer " << i+1 << " :" << endl;
cout << "Tytul: ";
getline(cin,titles[i]);
cout << "Ocena :";
cin >> ratings[i];
cin.get();
}
cout << "A teraz zobaczmy zestawienie filmow z ocenami: " << endl;
for(i=0;i<NUM;i++)
{
cout << ratings[i] << "\t" << titles[i] << endl;
}
return 0;
}
Błąd przy getline:
In function 'int main()':||error: no matching function for call to 'getline(std::istream&, std::vector<std::basic_string<char> >&)'
getline dostaje argumenty poprawnego typu, dołączyłem bibliotekę <string>, więc o co chodzi?
Błąd przy cin:
no match for 'operator>>' in 'std::cin >> ratings[i]'
nawet jeżeli zamiast
using namespace std;
piszę
using std::cin;
using std::cout;
using std::vector;
using std::string;
using std::endl;
to błąd i tak się wyświetla. Dlaczego? Proszę o pomoc.