Question: Make a function, int countTrue ( bool a , bool b , bool c , bool d ) , which reads four true / false

Make a function, int countTrue(bool a, bool b, bool c ,bool d), which reads four true/false values and returns the number of trues. Then, write a program (Exercise4.cpp) to test the function to type 4 bool values (true or false) and display the number of trues. The cin object needs to use "boolalpha" flag to read true as a bool value instead of string value of "true". The following shows two test cases.
Type four true/false values here.
true false true false
# of trues is: 2
Type four true/false values here. false true true true
# of trues is: 3,

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Programming Questions!