473,507 Members | 2,545 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

sstream

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
5 8009
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3166
by: vato | last post by:
I was hoping to get an example of a C++ program I am working on with my son need to calculate the average of a series of game scores where we can drop the lowest score. ie five games get the best...
3
5875
by: gouki | last post by:
suppose i have a class: class X { int i; string out; } X::out = "object x";
5
3435
by: Matthias Kaeppler | last post by:
Hello, in my application, I want to print file sizes in a human readable format. However, I remember a thread here which dealt with a similar issue, and people said it'd be a bad idea to write...
1
1557
by: Matthias Kaeppler | last post by:
Hello, this is related to another post by me, which sort went down, so I thought I'd make a new thread. My problem is, I want to display file sizes in the format X.YZ (two digits behind the...
2
2691
by: Praveen Chandra | last post by:
Hi, I am trying to build a static library, while building the library i am getting the following error: fatal error C1189: #error : "No sstream/strstream implementation" Following is the...
0
277
by: bpazolli | last post by:
Quick noob question. I have dev-C++ 4. I type in #include <sstream>. I get no such file. Ben Pazolli
1
2048
by: gowrinm | last post by:
Hi, I am getting build error when I used aCC compiler for compiling C++ code with <sstream> I don't know what is missing here. Should I have to link any standard libraries / Include PATH? I...
4
1538
by: arnuld | last post by:
I am tryign to understand the sstream class but got confused by its aspects. here is the example code: /* C++ Primer - 4/e * * Example from Section 8.5 - sstream * */
6
5685
by: arnuld | last post by:
This works fine, I welcome any views/advices/coding-practices :) /* C++ Primer - 4/e * * Exercise 8.9 * STATEMENT: * write a program to store each line from a file into a *...
0
7110
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7314
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7372
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5623
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5041
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3191
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1540
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
758
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
411
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.