#include <iostream>
#include <string>
using namespace std;
char *goodmsg = " I feel fine today \n";
string badmsg = "I am not feeling well today \n" ;
int main(){
//prototype definition
void printMessage( bool );
//objects declaration
bool isFine;
bool &isGood = isFine;
char *answer = 'y';
//while loop will repeat executing until user inputs other
//than y or Y
while ( answer =='y' || answer=='Y' ){
cout <<" How are you today ?" << endl
<<" If you feel good, answer 1 or else, answer 0 \n";
//request user input about his feeling
cin >> isFine ;
//print message according to user input
printMessage( isGood );
cout << "Another try (y/n) ?" ;
cin >> &answer;
}
return 0;
}
void printMessage( void isGood ) {
if ( isGood )
cout << goodmsg << endl;
else
cout << &badmsg << endl;
return ;
}
wussa 0 Newbie Poster
joshmo 8 Posting Whiz in Training
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Salem 5,199 Posting Sage
Daveodolph 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.