Answer to Question #99424 in C++ for Caleb

Question #99424
Assign isTeenager with true if kidAge is 13 to 19 inclusive. Otherwise, assign isTeenager with false.
#include <iostream>
using namespace std;

int main() {
bool isTeenager;
int kidAge;

cin >> kidAge;

/* Your solution goes here */

if (isTeenager) {
cout << "Teen" << endl;
}
else {
cout << "Not teen" << endl;
}

return 0;
}
1
Expert's answer
2019-12-01T13:20:48-0500
#include <iostream>

using namespace std;
int main() {
   
  int kidAge = 13;
  bool isTeenager = false;
  cin >> kidAge;
   
  if ((kidAge >= 13) && (kidAge <= 19))
  {
    if (isTeenager) {
      cout << "Teen" << endl;
  }
    else {
      cout << "Not teen" << endl;
  }
  return 0;
  }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS