Question: Can you update this code that it will reject non-numeric input (for inch and cm input) and negative number input.... show that illegal input #include

Can you update this code that it will reject non-numeric input (for inch and cm input) and negative number input.... show that "illegal input"

#include #include char menuSelect(); using namespace std;

int main(int argc,char* argv[]){ double inches; double centimeters; char select; do{ select=menuSelect(); if(select=='E'){ cout<<"Enter number of inches : "; cin>>inches; centimeters=inches*2.54; cout<>centimeters; // reading centimeters from user inches= centimeters/2.54; // converting into inches cout<>selection; selection=toupper(selection); }while(selection!='E' && selection!='M' && selection!='Q'); return selection; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Certainly Below is an updated version of the code This version includes input validation to ensure t... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!