Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

[noob][c++]  enum + float

Posted on 2007-11-15
7
Medium Priority
?
595 Views
Last Modified: 2007-11-15
precision and rounding and maybe other settings for float type needs to be adjusted

is enum what I should use?

I checked c++ in a nutshell by oreilly, but I can't seem to find any thing from it about enum.


how do I do this?
0
Comment
Question by:Troudeloup
  • 4
  • 3
7 Comments
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 20294726
could you detail more your problem?
0
 

Author Comment

by:Troudeloup
ID: 20295364
yeah.


float a;
a = 13000075

cout << a;


it output this


1.30001e+007
0
 

Author Comment

by:Troudeloup
ID: 20295460
or more precisely,


what is enum and how do I use it?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 20295475
you need to learn about STL output manipulators:

cout.precision(0);
cout <<   fixed    << a  << endl;

There are lots of manipulators, have a look to:
http://www.cplusplus.com/reference/iostream/manipulators/
0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 20295483
I don't figure out how enumerations can help you in this issue.
0
 

Author Comment

by:Troudeloup
ID: 20295497
are you saying that it's cout that chop off the parts, not the float type itself?
0
 
LVL 55

Accepted Solution

by:
Jaime Olivares earned 2000 total points
ID: 20295517
float value remains untouched. It is just a presentation matter.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
This article will show, step by step, how to integrate R code into a R Sweave document
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses
Course of the Month20 days, 15 hours left to enroll

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question