Не можу зрозуміти що роблю не так.
Hello, I’m working on this task:
Task with high complexity! It is ok to skip
You need to write a program that sends files to the antivirus scan. It should scan files only when Ritchie is NOT watching Noname’s state. The program should understand 4 commands: “scan”, “hide”, “unhide”, and “game over”. It should have two modes that can be toggled by using the commands “hide” and “unhide” commands. The default mode is “unhide”, which means that Ritchie is not watching. If the input is “scan” during the mode “unhide”, the program should output “scanning file {number}” where number is an integer that starts from 1 and increments by 1 for every new file. If the user inputs “scan” during the “hide” mode, the program should output “can’t scan files for viruses”. As soon as Ritchie leaves, the input will be switched to “unhide” and then it should be able to scan again. Your program should listen to the input commands indefinitely until the input is “game over”. In this case, the program should output “run” and exit. For example:
>scan
scanning file 1
>scan
scanning file 2
>hide
>scan
can’t scan files for viruses
>scan
can’t scan files for viruses
>unhide
>scan
scanning file 3
>game over
run
Here is my code:
namespace WhileLoop
{
class AntivirusScan
{
static void Main(string[] args)
{
string command = Console.ReadLine();
bool isScaning = true;
bool isHiding = false;
int number=1;
while (isScaning)
{
if (command=="scan")
{
Console.WriteLine($"scanning file {number+1}");
}
else if (command=="game over")
{
Console.WriteLine("run");
}
while (isHiding)
{
if (command=="scan")
Console.WriteLine ("can't scan files for viruses");
}
}
//while (i=="unhide")
//{
// while (j=="scan")
//}
}
}
}
Can anyone please help me to solve it?