D
D
DarkAnime2018-05-19 20:41:39
C++ / C#
DarkAnime, 2018-05-19 20:41:39

Why is the problem not correct?

Hello. I do tasks on this resource. And in the section Cyclic constructions I do a task:

After declaring the inputString variable, write a loop with a postcondition to output to the console, on a new line, the prompt "Enter a word that is 7 characters long" until the entered inputString is actually 7 characters long.

My decision:
string inputString = "";

  do
     {
          Console.WriteLine("Введите слово длиной в 7 символов:");
          inputString = Console.ReadLine();

     } while (inputString.Length != 7);

But the editor says it's wrong, why?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
eRKa, 2018-05-20
@kttotto

Your code is working correctly. Perhaps there is a code verification error on the resource.5b00aeb4c2977467279845.png

Y
Yuri Mikhailuts, 2018-05-19
@JBMurloc

Generally speaking, it looks right. Unless, when entering, an end-of-line character is added and when a word of 7 letters is entered, the total number of characters is greater.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question