473,386 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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 7989
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
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
by: gouki | last post by:
suppose i have a class: class X { int i; string out; } X::out = "object x";
5
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
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
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
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
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
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
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
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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...

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.