Solved

[noob][c++]  enum + float

Posted on 2007-11-15
7
544 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

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 is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.
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.

747 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now