98 973
Assignments Done
98.9%
Successfully Done
In May 2021

# Answer to Question #41683 in C++ for Tina

Question #41683
Write a program that prompts the user to enter a 3-digit integer. Then, if the integer is not an integer containing exactly 3 digits or is a 3-digit number begining with a 0, prompt the user again. Repeat this until the user correctly enters a 3-digit integer. Once the user has successfully entered the three digit integer, display the three digits on three separate lines.
1
2014-05-08T10:21:07-0400
#include <iostream>using namespace std;int main() {    int workingNumber, disas[3];    cout << "Please input 3 digit integer which does not begin with zero" << endl;    cin >> workingNumber;    while ( workingNumber < 100 || workingNumber > 999 ) {        cout << "You were suposed to input 3 digit integer which does not begin with zero" << endl;        cin >> workingNumber;    }    for ( int i = 2; i >=0; i-- ) {        disas[i] = workingNumber % 10;        workingNumber /= 10;        if ( disas[0] == 0 ) {            cout << "You were suposed to input 3 digit integer which does not begin with zero" << endl;            cin >> workingNumber;        }    }    for (int i = 0; i < 3; i++ ) {        cout << disas[i] << endl;    }    return 0;}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!