Write a C++ program to print an integer digit by digit. Your program should read (from the keyboard) a positive integer. It should then print out the number, one digit at a time. If you want, include 0 and negative numbers. Here we are simulating exactly the steps that assembly language goes through to print an integer. It's similar for a decimal. You should do this using a function. The function should do the printing. The main() function should read in the integer and call the function to print it. One suggestion is to do this recursively and use the % operator to get one digit.
// the language is c++, please put common in your code for better understanding.
Write a C++
You should do this using a function. The function should do the printing. The main() function should read in the integer and call the function to print it. One suggestion is to do this recursively and use the % operator to get one digit.
Your source should contain calls to your function demonstrating that it works. You can do this by showing sample runs. Cut and paste the results of the runs into a separate document and submit that to Canvas.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 3 images