Q:

How can I make an " if " statement true using a number in-between 2 numbers? C++

In my opinion I feel like many people are confused about this question. What I want to do is ask the user for a number and if it is between 0 - 17, the output I would want it to be is:
Too Young

And if it is 18 - 42, the output should be:
Adult

And if it's 43 and over to be:
Senior

All while using the switch statement
Here is the code I used:
#include <iostream>
using namespace std;

int main()
{
    int age;
    cin >> age;
    if (age <= 16) {
        cout <<"Too young";
    }
    if (age <= 42) {
        cout << "Adult";
    }
    if (age <= 70) {
        cout << "Senior";
    }

    return 0;
}

The output of my code is:
Too YoungAdultSenior

Please help me out.

A:

Replace your code with:
#include <iostream>
using namespace std;

int main()
{
    int age;
    cin >> age;
    if (age <= 17) {
        cout <<"Too young";
    } else if (age <= 42) {
        cout << "Adult";
    } else {
        cout << "Senior";
    }

    return 0;
}

