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;}
IN C++ Define a function InspectVals() with no parameters that reads integers from input until integer 1 is read. The fu
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am