473,511 Members | 10,974 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 8010
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
3169
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
1558
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
2692
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
7245
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7356
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
7427
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...
1
7085
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7512
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5671
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,...
0
3214
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1577
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
785
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.