Ask your own question, for FREE!
Computer Science 22 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!
Latest Questions
Breathless: Spooky witch but cute
4 hours ago 3 Replies 0 Medals
Arriyanalol: help
3 hours ago 10 Replies 2 Medals
Arriyanalol: @tinydinoUwU stop trying to find a argument u blad lil boy
1 day ago 5 Replies 3 Medals
Jaded012023: Please tell me what you all think of this song
6 hours ago 6 Replies 1 Medal
Arriyanalol: bro how
6 hours ago 2 Replies 3 Medals
Arriyanalol: cant wait for the new bluey movie in 2027
1 day ago 12 Replies 2 Medals
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!