Course Content
Introduction to C++
Introduction to C++
Challenge
Let's practice!
Swipe to show code editor
Your code accepts the sentence from the user. You should define if it is short, medium, or large.
- Accept the text message from the user as input and store it in the variable
sentence
. - Using the statement
if
and functionlength()
we check if our statement is large. If the sentence’s length is greater than30
, we print the message"The sentence is large!"
. - Using the statement
else if
and functionlength()
we check if our statement is medium. If the sentence’s length is greater than10
(but less than30
), we print the message `"The sentence is medium!". - Using the statement
else
and functionlength()
we check if our statement is short. If the sentence’s length is less than10
, we print the message"The sentence is medium!"
.
Please, don’t forget to type the semicolon at the end of the lines.
Thanks for your feedback!
Challenge
Let's practice!
Swipe to show code editor
Your code accepts the sentence from the user. You should define if it is short, medium, or large.
- Accept the text message from the user as input and store it in the variable
sentence
. - Using the statement
if
and functionlength()
we check if our statement is large. If the sentence’s length is greater than30
, we print the message"The sentence is large!"
. - Using the statement
else if
and functionlength()
we check if our statement is medium. If the sentence’s length is greater than10
(but less than30
), we print the message `"The sentence is medium!". - Using the statement
else
and functionlength()
we check if our statement is short. If the sentence’s length is less than10
, we print the message"The sentence is medium!"
.
Please, don’t forget to type the semicolon at the end of the lines.
Thanks for your feedback!
Challenge
Let's practice!
Swipe to show code editor
Your code accepts the sentence from the user. You should define if it is short, medium, or large.
- Accept the text message from the user as input and store it in the variable
sentence
. - Using the statement
if
and functionlength()
we check if our statement is large. If the sentence’s length is greater than30
, we print the message"The sentence is large!"
. - Using the statement
else if
and functionlength()
we check if our statement is medium. If the sentence’s length is greater than10
(but less than30
), we print the message `"The sentence is medium!". - Using the statement
else
and functionlength()
we check if our statement is short. If the sentence’s length is less than10
, we print the message"The sentence is medium!"
.
Please, don’t forget to type the semicolon at the end of the lines.
Thanks for your feedback!
Let's practice!
Swipe to show code editor
Your code accepts the sentence from the user. You should define if it is short, medium, or large.
- Accept the text message from the user as input and store it in the variable
sentence
. - Using the statement
if
and functionlength()
we check if our statement is large. If the sentence’s length is greater than30
, we print the message"The sentence is large!"
. - Using the statement
else if
and functionlength()
we check if our statement is medium. If the sentence’s length is greater than10
(but less than30
), we print the message `"The sentence is medium!". - Using the statement
else
and functionlength()
we check if our statement is short. If the sentence’s length is less than10
, we print the message"The sentence is medium!"
.
Please, don’t forget to type the semicolon at the end of the lines.