Solved

[noob][c++]  enum + float

Posted on 2007-11-15
7
577 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 500 total points
ID: 20295517
float value remains untouched. It is just a presentation matter.
0

Featured Post

Industry Leaders: 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!

Question has a verified solution.

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

Suggested Solutions

Having just graduated from college and entered the workforce, I don’t find myself always using the tools and programs I grew accustomed to over the past four years. However, there is one program I continually find myself reverting back to…R.   So …
This article will show, step by step, how to integrate R code into a R Sweave document
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
This video teaches viewers about errors in exception handling.

685 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