By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,984 Members | 1,045 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,984 IT Pros & Developers. It's quick & easy.

sstream

P: n/a
Quick noob question. I have dev-C++ 4 doing a tutorial. Typed in
#include <sstreamand get file does not exist.

Thanks,
Ben Pazolli

Dec 28 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a
bpazolli wrote:
Quick noob question. I have dev-C++ 4 doing a tutorial. Typed in
#include <sstreamand get file does not exist.
In decreasing order of likelihood, you either typed something
incorrectly (per FAQ 4.8, cut and paste your exact code here), your
environment is not set up properly to find the include file (seek help
in a forum dedicated to your platform), or your platform does not have
a standard-conforming C++ library currently installed (install a
complete development package or download STLport or similar).

Cheers! --M

Dec 28 '06 #2

P: n/a
bpazolli wrote:
Quick noob question. I have dev-C++ 4 doing a tutorial. Typed in
#include <sstreamand get file does not exist.

Thanks,
Ben Pazolli
Have you tried this?

5. When I compile a file, I get a message saying "could not find <filename>
"

http://www.bloodshed.net/faq.html#5
Bo Persson
Dec 28 '06 #3

P: n/a
In decreasing order of likelihood, you either typed something
incorrectly (per FAQ 4.8, cut and paste your exact code here), your
environment is not set up properly to find the include file (seek help
in a forum dedicated to your platform), or your platform does not have
a standard-conforming C++ library currently installed (install a
complete development package or download STLport or similar).
I downloaded some source files for Dev-C++ for another tutorial using
sstream and it also didn't compile correctly, so it probably isn't a
mistype. I suspect I don't have the environment set up properly as I
did a typical install of Dev-C++ 4. None the less, here is my entire
code, just a tutorial so it does very little in a long winded way, I
want to know how to make it work this way though, not how I could do it
in one line another way.

#include <iostream>
#include <string>
#include <sstream>
using namespace std;

int main()
{
string mystr;
float price = 0;
int quantity = 0;

cout << "Enter price: ";
getline (cin,mystr);
stringstream(mystr) >price;
cout << "Enter quantitiy: ";
getline (cin,mystr);
stringstream(mystr) >quantity;
cout << "Total price: " << price*quantity << endl;
return 0;
}

Thanks,
Ben Pazolli

Dec 28 '06 #4

P: n/a
bpazolli wrote:
In decreasing order of likelihood, you either typed something
incorrectly (per FAQ 4.8, cut and paste your exact code here), your
environment is not set up properly to find the include file (seek help
in a forum dedicated to your platform), or your platform does not have
a standard-conforming C++ library currently installed (install a
complete development package or download STLport or similar).

I downloaded some source files for Dev-C++ for another tutorial using
sstream and it also didn't compile correctly, so it probably isn't a
mistype. I suspect I don't have the environment set up properly as I
did a typical install of Dev-C++ 4. None the less, here is my entire
code, just a tutorial so it does very little in a long winded way, I
want to know how to make it work this way though, not how I could do it
in one line another way.

#include <iostream>
#include <string>
#include <sstream>
using namespace std;

int main()
{
string mystr;
float price = 0;
int quantity = 0;

cout << "Enter price: ";
getline (cin,mystr);
stringstream(mystr) >price;
cout << "Enter quantitiy: ";
getline (cin,mystr);
stringstream(mystr) >quantity;
cout << "Total price: " << price*quantity << endl;
return 0;
}
This builds fine at <http://dinkumware.com/exam>, so I expect it is a
problem with your installation or configuration.

Cheers! --M

Dec 28 '06 #5

P: n/a
I read the almost exact same problem on another forum. I think the only
answer is to upgrade to beta version 5. I'm not interested in that, so
instead I downloaded a borland free command line compiler from their
site, version 5.5, and it worked great. I created a batch file, now all
I type in is bcc main.cpp, and it creates the exe. Simple. IDEs just
complicate things at this level.

Thanks for the Help,
Ben Pazolli

Dec 29 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.