Okay I'm trying to use a bool function to either continue or terminate the program, but I'm not quite sure what I'm doing wrong. I'm trying to use what I've learned from my previous programs but I think I'm messing something up with the parameters that I'm sending or maybe with the bool test. Any help would be appreciated. Thanks.
Code:#include <cstdlib> #include<iostream> using namespace std; bool repeat(char choice) { bool test=true; test = (choice =='y') || (choice =='Y'); if (test=true) { return true; } else { return false; } } int main() { cout<< "do while loop" << endl; int i=1, sum,num; bool answer; char choice; sum =0; do { cout<< "Enter number "<< i << "->"; cin>> num; sum += num; i++; cout<<"Enter Y or y to try again >>"<<endl; cin>>choice; answer=repeat(choice); } while(answer!=false); cout<< "The sum is: "<< sum<< endl <<endl; system("pause"); return 0; }