954,132 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

setprecision

I have #include header also and it's still not working.I am getting 2 dec places but it's .00 Why is that?Please help.
here is the code
cout << showpoint << fixed << setprecision (2);
cout<<"The Mean is "<
#include
#include
usingnamespace std;
int main()
{

char choice;
const int arraysize=20;
int num[arraysize];
do
{

cout<<"I will give you the Sum,Mean,Var & the Std Dev of any series of numbers?Y/N:"<>choice;
if(choice =='Y'||choice =='y')
{

cout<<"How many numbers will you enter? (up to 20)?"; cin>>num[arraysize];
for (int j=0;j> num[j];
}

cout << " You have entered the following:"<

Sashar400
Newbie Poster
9 posts since Aug 2006
Reputation Points: 22
Solved Threads: 0
 
I have #include header also and it's still not working.I am getting 2 dec places but it's .00 Why is that?Please help. here is the code cout << showpoint << fixed << setprecision (2); cout<<"The Mean is "< If you want help you need to post the whole code. Read this
andor
Posting Whiz in Training
276 posts since Jun 2005
Reputation Points: 251
Solved Threads: 29
 

entire code

#include
#include
#include
usingnamespace std;
int main()
{

char choice;
const int arraysize=20;
int num[arraysize];
do
{

cout<<"I will give you the Sum,Mean,Var & the Std Dev of any series of numbers?Y/N:"<>choice;
if(choice =='Y'||choice =='y')
{

cout<<"How many numbers will you enter? (up to 20)?"; cin>>num[arraysize];
for (int j=0;j> num[j];
}

cout << " You have entered the following:"<

Sashar400
Newbie Poster
9 posts since Aug 2006
Reputation Points: 22
Solved Threads: 0
 

lovely code -- but what is your question ? please edit your post to include code tags.

Ancient Dragon
Retired & Loving It
Team Colleague
30,040 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,341
 

Please explain the problem clearly so that we can help you out. Post your entire code along with the problems you are encountering.. whether it is compile time error or run time error or the program is not working as expectd and so on. Maybe then we would be able to help you out.

~s.o.s~
Failure as a human
Administrator
11,938 posts since Jun 2006
Reputation Points: 3,281
Solved Threads: 733
 

I suggest you do a google search of setprecision and pow.

I think pow expects a double somewhere. So you'll have to write pow(2,3) and pow (2.0,3.0) or something? Not to sure.

iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You