Page 1 of 1

Write a program that could determine the input Example: string is a whole number (integer) or not. L\Mac Home\Documents\

Posted: Fri May 20, 2022 5:24 pm
by answerhappygod
Write A Program That Could Determine The Input Example String Is A Whole Number Integer Or Not L Mac Home Documents 1
Write A Program That Could Determine The Input Example String Is A Whole Number Integer Or Not L Mac Home Documents 1 (148.42 KiB) Viewed 45 times
Write a program that could determine the input Example: string is a whole number (integer) or not. L\Mac Home\Documents\NCKU IPL\... - х User inputs the data. If the data is not a number, the program outputs the error message and asks for another input. If the data is a number, please assign the value to an integer variable and print out the result. *****Enter a number: 123ABC It is not a number! *****Enter a number: 12345 The number you entered is 12345 Use character array for this homework, NOT string library. Please reference the template next page. Hint: check every element in the array if it matches the numeric character in ASCII Introduction to Computers, C.. Chang late: e//HN6-1 // Using array to determine if the input string is integer or not #include <iostream> using std::cout; using std::cin; using std::endl; #include <cmath> using std::pow; int main() { 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 const int maxlength - 10; // Array dinension char values (maxlength] = { }; // Array to hold input string int number = ; // Integer to save the result Your code... cout << "\nThe number you entered is " << number << endl; cout << endl; system("pause"); return 0;