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

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

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

Post 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 43 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;
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply