reset password
Author Message
harry_520
Posts: 76
Posted 11:46 Jan 17, 2015 |

I'm having trouble with last 3 methods? How do I print out only one result either true or false? I tried "return true" and "return false" they don't print out anything. Is cout the only way to display the Boolean value?

Last edited by harry_520 at 12:00 Jan 17, 2015.
harry_520
Posts: 76
Posted 12:13 Jan 17, 2015 |

Never mind. I got it figured out.

Last edited by harry_520 at 12:14 Jan 17, 2015.
kknaur
Posts: 540
Posted 14:52 Jan 17, 2015 |

Glad you could figure it out.  Just a reminder, in c++ printing a boolean will not print the words true or false,  it will print 0 or 1.  If you want to print text instead, a simple if statement or conditional expression will help.

harry_520
Posts: 76
Posted 18:45 Jan 17, 2015 |

Is it ok to make the return type as char*?

kknaur
Posts: 540
Posted 18:47 Jan 17, 2015 |

If I didn't say specifically anything about return types, then you may design the functions any way you wish.

jpascua
Posts: 197
Posted 18:49 Jan 17, 2015 |

What does it mean to have an asterisk after a data type?

data_type*

Maybe I overlooked this on the lecture notes?

kknaur
Posts: 540
Posted 18:51 Jan 17, 2015 |

You mean something like int * variable_name ? If so this is how you create a pointer, which we have not really discussed in detail.  Try to avoid using pointers until I go over them in class.

jpascua
Posts: 197
Posted 18:53 Jan 17, 2015 |

Alright.