Page 1 of 1

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

Posted: Tue Jul 05, 2022 10:27 am
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;}