Ask your own question, for FREE!
Computer Science 17 Online
OpenStudy (bahrom7893):

C++ gurus help!!!

OpenStudy (bahrom7893):

Why is this not working properly?

OpenStudy (bahrom7893):

see the screenshot, I want the decimals to show up too.. the assignment is on the bottom, my code is on the right

OpenStudy (bahrom7893):

I tried float, I tried fixed setprecision.. they are always showing up as either 4, 3, 3, or 4.000, 3.000, 3.000 etc..

OpenStudy (anonymous):

the numbers you are using are represented as ints and the / just yield an int. Try to add a .0 after them.

OpenStudy (bahrom7893):

oh i see THANKS!!!

OpenStudy (anonymous):

Get the system("pause"); out of there and see a way to simplfy the program so that I can ask you x number of iterations(precision) of Pi.

OpenStudy (bahrom7893):

I need pause to see the screen though..

OpenStudy (bahrom7893):

well anyway the problem is solved now, thanks =)

OpenStudy (anonymous):

Honestly your code is not portable + that system call is a security vulnerability. What you could do is simply a cin >> and wait for an input.

OpenStudy (bahrom7893):

yea I know but why bother the assignment doesn't ask for it..

OpenStudy (anonymous):

Because Winblows is sucking your mind. Either way you should aspire for more. Are you just going to be happy with a "just enough"?

OpenStudy (bahrom7893):

lol nope but i have ten more programs to write, so i'd rather finish my hw first maybe play around later.. check this out, i made this yesterday, it was fun

OpenStudy (bahrom7893):

OpenStudy (bahrom7893):

this is an elementary class haha this is my 2nd week.

OpenStudy (anonymous):

Cant, I am on Linux + would prefer source code than binary.

OpenStudy (bahrom7893):

ohh hold on:

OpenStudy (anonymous):

Maybe you should have declared separate functions and make it a little bit more organized. Some messages could have been in a variable and make typing faster + improve readability. Other than that nice job :)

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!