Somebody can help me!

What wrong with this coding, try to compile and get result like this:

"g++.exe -x c++ -c M:\MAN@PO~1\SEM3~1\DATAST~1\test -o M:\MAN@PO~1\SEM3~1\DATAST~1\test.o -Wall -fpermissive -Wno-sign-compare -g
M:\MAN@PO~1\SEM3~1\DATAST~1\test:4: sstream: No such file or directory
Failure"

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// pointers to structures
#include <iostream>
#include <string>
#include <sstream>
using namespace std;

struct movies_t {
	string title;
	int year;
};

int main ()
{
	string mystr;
	
	movies_t amovie;
	movies_t * pmovie;
	pmovie = &amovie;
	
	cout<< "Enter title: ";
	getline (cin, pmovie->title);
	cout<< "Enter year: ";
	getline (cin, mystr);
	(stringstream) mystr >> pmovie->year;
	
	cout<<"\nYOur have entered:\n";
	cout<<pmovie->title;
	cout<<"("<<pmovie->year << ")\n";
	
	return 0;
}
What is the version of the compiler?
I think your use of stringstream is wrong...

try
1
2
3
getline(cin, mystr);
stringstream myStream(mystr);
myStream >> pmovie->year;

Jens' File Editor
Version Aug 4 2002 - 08:57:29

What the compiler you are recommend for me as newbie on programming of c++ ?

Thanks
Dear Manga,

What line i need replace the code with the code you provide that.

THanks
lines 23 and 24.
Topic archived. No new replies allowed.