Is Armstrong Number : Problem Set

What does the output format as boolean mean ?

Hi Krishanu ,
Output format as boolean means you should print “true” if the entered number is an Armstrong Number and “false” if its not (Without the double quotes).

Can you please give an example how can we use it to print true and false without using double quotes,by using if…else statement?

Lets say I have written a function named check which returns a bool type .

bool check(int n)
{



}

Then in the main ( ) , I call this check function and then print “true” or “false” based on the value returned by this function

int n;
cin >> n;
if( check( n ) )
{ cout << “true” ; }
else
{ cout << “false” ; }

Alternatively you can use ‘boolalpha’ with cout to directly print “true” and “false” as well .

cout << boolalpha << check(n) ;

This will directly print “true” or “false” based on whatever check( ) returns.