+ 10

How to deal with C++ questions, in which we have to tell the output of the given programme. Especially increment decrement ones.

4th Feb 2018, 6:28 AM
Prachi Chauhan
Prachi Chauhan - avatar
7 Réponses
+ 8
I'm unable to solve those questions in which we have to tell the output (C++). I want one to explain such questions of different patterns. (examples)
6th Feb 2018, 3:36 PM
Prachi Chauhan
Prachi Chauhan - avatar
+ 8
Please guide
6th Feb 2018, 3:36 PM
Prachi Chauhan
Prachi Chauhan - avatar
+ 8
I need to send you images of some questions.then you will get to know what solutions I am asking for. how to send pics here?
6th Feb 2018, 4:09 PM
Prachi Chauhan
Prachi Chauhan - avatar
+ 8
I'm not able to do above.
7th Feb 2018, 9:34 AM
Prachi Chauhan
Prachi Chauhan - avatar
0
If I understand correctly, are you wanting to ask the user questions and depending on the answer, increment/decrement a score value?If so, are these questions yes/no based, age/number inputs? If so you can use if statements or bools for th checks. I could give an example if this is what you're looking for.
6th Feb 2018, 3:24 PM
Al Z
Al Z - avatar
0
Well you didn't fully answer my question so I'll assume that's what you want to do.. Let's start with a true/false. This is without error checking... int main() { char userInput; int age; cout << "Do you speak English?" << endl: cin >> userInput if( userInput == 'y') { //do something cout << "How old are you?‚ÄĚ << endl; cin >> age; if(age > 20) { //User is of age, do something? } else { // Do something else } } else { // otherwise do something else } } That is a very crude example of if/nested if statements for yes/no question and asking for an age. Hope this helps.
6th Feb 2018, 3:46 PM
Al Z
Al Z - avatar
0
You'll need to upload it somewhere and send me a link to the picture.
6th Feb 2018, 4:14 PM
Al Z
Al Z - avatar