Question: Hello I need help with my C++ code. How can I pause the while loop that says the number is too large and then display
Hello I need help with my C++ code. How can I pause the while loop that says the number is too large and then display to the user if the user wants to continue if not break the loop? Thanks
Code:
#include
using namespace std;
int main() {
fstream output; long int num; // you cant use small c, as cout is a keyword in c++. char exit = NULL;
output.open("output.txt", fstream::out);
output
if (output.is_open()) {
while (exit != 'n' && exit != 'N') {
cout > num;
while (num > 2000000000 || num
if (num > -10 && num -100 && num = 10 && num -1000 && num = 100 && num -10000 && num = 1000 && num -100000 && num = 10000 && num -1000000 && num = 100000 && num -10000000 && num = 1000000 && num -100000000 && num = 10000000 && num -1000000000 && num = 100000000 && num -10000000000 && num = 1000000000 && num
cout > exit; } output.close(); } else cout
return 0;
}
Requirements:

Sample output with error:

Write a program to read an integer number and find its number of digits (for example, 3459 has 4 digits and 125860 has 6 digits). The program should be designed in a way that the user could test as many numbers as desired without leaving the program. Use only long integer (int or long int) data type in this problem; however make sure that the program rejects any input outside the long integer data range. The outputs of the program should be written to an output file having a format similar to the following table. VALUE ENTERED NUMBER OF DIGITS 1241 19 5684900 uw - NA 1267678901 -153 62000 Test the program for at least seven integer values between + 2,000,000,000 and a number outside the long int data range. Remember to submit a copy of the program file and a copy of the output file. Note: You should use while or do-while loop in this assignment. The number is too large The number is too large The number is too large The number is too large The number is too large The number is too large The number is too large The number is too large The number is too large The number is too large The number is too large The number is too large The number is too large The number is too large The number is too large The number is too large The number is too large The number is too large The number is too large The number is too large The number is too large The number is too large The number is too large The number is too large The number is too large The number is too large The number is too large The number is too large The number is too large
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
