![]() |
| ||
| Still need info on calling a function from bool! I have never seen an example of this, but I need to call a function or another bool from inside a bool! If anyone knows how this might go, please let me know. P.S. This website is awsome! Thanks, Paul //something like this, however this is not working... bool getEmployeeData(int ID) { cout << "Enter employee ID: " << endl; cin >> ID; if (ID >= 0) { return true; bool isValidStatus; } else { cout << "*** Program Terminated ***" << endl; exit (0); return false; } } bool isValidStatus (int status) { cout << "Enter payroll status: " << endl; cin >> status; if (status == 's' || status == 'S' || status == 'c' || status == 'C' || status == 'h' || status == 'H') { cout << status; return tryAgain; } else { bool tryAgain (int quit); return false; } } |
| ||
| Re: Still need info on calling a function from bool! >but I need to call a function or another bool from inside a bool! Work on your terminology first, because I have no clue what you want. Let's get this straight, bool is a type. bool has two values: true and false. You don't call squat from inside a bool because all it does is represent true or false, nothing else. You can have functions that return bool, or statements that result in bool, but they're not bool and shouldn't be referred to as such if you want to have meaningful conversation with intelligent parties. |
| ||
| Re: Still need info on calling a function from bool! Yes, you can call other functions from inside a bool. I may be a newbie, but I would appreciate some respect if you respond to me! Otherwise don't bother responding. |
| ||
| Re: Still need info on calling a function from bool! I do not really understand the problem that you have. But a few explanations might help if (ID >= 0) {maybe you want something like this #include <iostream>Hope this helps. btw. Naru seems to be here to insult people. K. |
| ||
| Re: Still need info on calling a function from bool! >Yes, you can call other functions from inside a bool. Then you're not using the proper terminology. A bool is true or false, that's it. There's no way to call a function from inside a value. I suspect that what you're thinking of is calling a function in a conditional test: #include <iostream>or calling a function that returns bool from another function that returns bool: #include <iostream>>but I would appreciate some respect if you respond to me! I do respect you for various reasons, but I don't respect your complete lack of an attempt to express yourself in a way that is conducive to getting help. I'm not going to guess what you want simply because you don't know how to ask the question in a way that we can understand. So let's go over this one more time. A bool is a data type with two values. Functions can return bool, expressions can result in bool, but the only thing that can be inside bool is true or false that map to non-zero and zero integral values, respectively. Tell me how to call a function from within 0 and I'll reconsider this explanation. >btw. Naru seems to be here to insult people. I'm not responsible for your misconceptions. Though I don't like the insinuation that I don't help people here. |
| All times are GMT -4. The time now is 11:03 am. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC