hey guys im working on a homework problem..im done with 99% of the problem :|however i cnt figure out how to display my output(which is in dollars) using the comma
my output shows >>160000
how would i make it >>160,000
um should i use setprecision???
please help
thanks:)
i_luv_c++
26
Light Poster
Recommended Answers
Jump to PostSo is it:
1. 160 dollar. (one-hundred-sixty)
2. 160.00 dollar (one-hundred-sixty dollar and 00 cents)
3. 160.000 (one-hundred-sixty-thousand)?
Jump to Post#include <string> #include <sstring> using std::string; using std::stringstream; int main() { int n = 1234567890; stringstream str; // insert int into stringstream str << n; // convert to std::string string s = str.str(); // now just insert commas in appropriate places }
All 6 Replies
Nick Evan
4,005
Industrious Poster
Team Colleague
Featured Poster
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
i_luv_c++
26
Light Poster
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
WaltP
2,905
Posting Sage w/ dash of thyme
Team Colleague
i_luv_c++
26
Light Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.