#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
Recommended Answers
Jump to Postline 10: that is a function prototype and should appear outside any function, such as on line 6.
And the parameters in the function prototype on line 10 doesn't match the parameters in the actual function on line 35. The two must match exactly.
All 4 Replies
joshmo 8 Posting Whiz in Training
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Salem 5,265 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.