könnte mir jemand bei der Behebung des Fehlers in folgendem Programm helfen? Es ist das Beispiel aus einem Tutorial zu structures, und da ich gerade noch ganz am Anfang stehe, hab ich keine Ahnung wo der Fehler liegen könnte...
Die Fehlermeldung lautet "invalid use of undefined type struct std:: stringstream", beim Googeln nach invalid und stringstream hab ich aber nichts gefunden, das mir weiterhelfen könnte.
C-Quellcode
- #include <cstdlib>
- #include <iostream>
- using namespace std;
- #define NMOVIES 3
- struct movies_t
- {
- string title;
- int year;
- } films[NMOVIES];
- int main(int argc, char *argv[])
- {
- string filmyear;
- for (int n=0; n<NMOVIES; n++)
- {
- cout << "Enter title: ";
- getline (cin,films[n].title);
- cout << "Enter year: ";
- getline (cin,filmyear);
- stringstream(filmyear) >> films[n].year;
- }
- }
- system("PAUSE");
- return EXIT_SUCCESS;
- }
Danke schon mal
ruebe