Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Challenge | Conditional Statements
Introduction to C++
course content

Зміст курсу

Introduction to C++

Introduction to C++

1. Basics
2. Variables
3. Conditional Statements
4. Loops
5. Intro to Arrays

Challenge

Let's practice!

Завдання

Your code accepts the sentence from the user. You should define if it is short, medium, or large.

  1. Accept the text message from the user as input and store it in the variable sentence.
  2. Using the statement if and function length() we check if our statement is large. If the sentence’s length is greater than 30, we print the message "The sentence is large!".
  3. Using the statement else if and function length() we check if our statement is medium. If the sentence’s length is greater than 10 (but less than 30), we print the message `"The sentence is medium!".
  4. Using the statement else and function length() we check if our statement is short. If the sentence’s length is less than 10, we print the message "The sentence is medium!".

Please, don’t forget to type the semicolon at the end of the lines.

Завдання

Your code accepts the sentence from the user. You should define if it is short, medium, or large.

  1. Accept the text message from the user as input and store it in the variable sentence.
  2. Using the statement if and function length() we check if our statement is large. If the sentence’s length is greater than 30, we print the message "The sentence is large!".
  3. Using the statement else if and function length() we check if our statement is medium. If the sentence’s length is greater than 10 (but less than 30), we print the message `"The sentence is medium!".
  4. Using the statement else and function length() we check if our statement is short. If the sentence’s length is less than 10, we print the message "The sentence is medium!".

Please, don’t forget to type the semicolon at the end of the lines.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів

Все було зрозуміло?

Секція 3. Розділ 7
toggle bottom row

Challenge

Let's practice!

Завдання

Your code accepts the sentence from the user. You should define if it is short, medium, or large.

  1. Accept the text message from the user as input and store it in the variable sentence.
  2. Using the statement if and function length() we check if our statement is large. If the sentence’s length is greater than 30, we print the message "The sentence is large!".
  3. Using the statement else if and function length() we check if our statement is medium. If the sentence’s length is greater than 10 (but less than 30), we print the message `"The sentence is medium!".
  4. Using the statement else and function length() we check if our statement is short. If the sentence’s length is less than 10, we print the message "The sentence is medium!".

Please, don’t forget to type the semicolon at the end of the lines.

Завдання

Your code accepts the sentence from the user. You should define if it is short, medium, or large.

  1. Accept the text message from the user as input and store it in the variable sentence.
  2. Using the statement if and function length() we check if our statement is large. If the sentence’s length is greater than 30, we print the message "The sentence is large!".
  3. Using the statement else if and function length() we check if our statement is medium. If the sentence’s length is greater than 10 (but less than 30), we print the message `"The sentence is medium!".
  4. Using the statement else and function length() we check if our statement is short. If the sentence’s length is less than 10, we print the message "The sentence is medium!".

Please, don’t forget to type the semicolon at the end of the lines.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів

Все було зрозуміло?

Секція 3. Розділ 7
toggle bottom row

Challenge

Let's practice!

Завдання

Your code accepts the sentence from the user. You should define if it is short, medium, or large.

  1. Accept the text message from the user as input and store it in the variable sentence.
  2. Using the statement if and function length() we check if our statement is large. If the sentence’s length is greater than 30, we print the message "The sentence is large!".
  3. Using the statement else if and function length() we check if our statement is medium. If the sentence’s length is greater than 10 (but less than 30), we print the message `"The sentence is medium!".
  4. Using the statement else and function length() we check if our statement is short. If the sentence’s length is less than 10, we print the message "The sentence is medium!".

Please, don’t forget to type the semicolon at the end of the lines.

Завдання

Your code accepts the sentence from the user. You should define if it is short, medium, or large.

  1. Accept the text message from the user as input and store it in the variable sentence.
  2. Using the statement if and function length() we check if our statement is large. If the sentence’s length is greater than 30, we print the message "The sentence is large!".
  3. Using the statement else if and function length() we check if our statement is medium. If the sentence’s length is greater than 10 (but less than 30), we print the message `"The sentence is medium!".
  4. Using the statement else and function length() we check if our statement is short. If the sentence’s length is less than 10, we print the message "The sentence is medium!".

Please, don’t forget to type the semicolon at the end of the lines.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів

Все було зрозуміло?

Let's practice!

Завдання

Your code accepts the sentence from the user. You should define if it is short, medium, or large.

  1. Accept the text message from the user as input and store it in the variable sentence.
  2. Using the statement if and function length() we check if our statement is large. If the sentence’s length is greater than 30, we print the message "The sentence is large!".
  3. Using the statement else if and function length() we check if our statement is medium. If the sentence’s length is greater than 10 (but less than 30), we print the message `"The sentence is medium!".
  4. Using the statement else and function length() we check if our statement is short. If the sentence’s length is less than 10, we print the message "The sentence is medium!".

Please, don’t forget to type the semicolon at the end of the lines.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Секція 3. Розділ 7
Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
We're sorry to hear that something went wrong. What happened?
some-alt