anonymous
  • anonymous
Need help finishing this code its supposed to print out commas after every third # but it is adding an extra 0 at the end of both commas
Computer Science
  • Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
SOLVED
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
chestercat
  • chestercat
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
anonymous
  • anonymous
#include using namespace std; int main() { int first3, middle3, last3; int original, temp, first, second,third, fourth, first1, second1, third1, fourth1; cout<<"enter a 7-9 digit number"<>original; temp=original/1000; last3=original%1000; first=last3/10; second=last3%10; third=first/10; fourth=first%10; first3=temp/1000; middle3=temp%1000; first1=middle3/10; second1=middle3%10; third1=first1/10; fourth1=first1%10; cout<<"the number with a comma is "<
anonymous
  • anonymous
i doesnt put zeros it just puts some random numbers
eSpeX
  • eSpeX
http://ideone.com/RhtIN input: 123456789 output: enter a 7-9 digit number temp= 123456 last3= 789 first= 78 second= 9 third= 7 fourth= 8 first3= 123 middle3= 456 first1= 45 second1= 6 third1= 4 fourth1= 5 the number with a comma is 123,4564,7897 It is just a matter of keeping track of your variables.

Looking for something else?

Not the answer you are looking for? Search for more explanations.

More answers

anonymous
  • anonymous
@eSpeX So what would i type in the last cout statement to get it write
eSpeX
  • eSpeX
cout<
rsmith6559
  • rsmith6559
A pretty printed number is a string. it's easier to do the fomatting with the string than th number.

Looking for something else?

Not the answer you are looking for? Search for more explanations.