IN C++ Define a function InspectVals() with no parameters that reads integers from input until integer 1 is read. The fu

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: 899603
Joined: Mon Aug 02, 2021 8:13 am

IN C++ Define a function InspectVals() with no parameters that reads integers from input until integer 1 is read. The fu

Post by answerhappygod »

IN C++
Define a function InspectVals() with no parameters that readsintegers from input until integer 1 is read. The function returnstrue if all integers read before 1 are positive, otherwise, returnsfalse. Ex: If the input is 25 70 30 1, then the output is: Allmatch Note: Positive numbers are greater than zero.
code:
#include <iostream>using namespace std;
/* Your code goes here */
int main() { bool allPositive;
allPositive = InspectVals(); if (allPositive) { cout << "All match" << endl; } else { cout << "Not all match" << endl; }
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