Onboarding - Puzzle discussion

same problem how to do it… :confused:

I dont’ know what is wrong with this code, in the first case works but it doesn’t in the second becouse the cannon become too slow. please any1 help me!!!

Edit: No full code :stuck_out_tongue:

You should use the provided code, it give you both enemy every turn. :slight_smile:

READ BEFORE POSTING, thanks :dizzy_face:

IS this web site learn us how to use differents langages without any knowledge ? or not

Not at the moment, you’ll have a basic default template code which help you with input and loop of each language, but for the specifics, you’ll have to use google, which will provides you with dozens of tutorials.

Keep coding :wink:

Erm I don’t know what to do here :smiley:

this is the code i used in C

NO FULL CODE

it gave me error msg of’Timeout: your program did not provide an input in due time.’ … please tell me why ?

Hello,
I’m trying to compile this code in C# and get error msg “Input string was not in a correct format”.

int? dist1 = int.Parse(Console.ReadLine()); // distance to enemy 1
            int? dist2 = int.Parse(Console.ReadLine()); // distance to enemy 2

Here I am testing first case - If one enemy is empty or distance is null, should return another enemy.

if ((dist1.Value==null) ||(String.IsNullOrEmpty(enemy1)))
 Console.WriteLine(enemy2);
            else if ((dist2.Value == null) || (String.IsNullOrEmpty(enemy2)))
            Console.WriteLine(enemy1);

Please help me

You should both remove the last if.

1 Like

Hi,
In this problem I´m trying to use C language,I acomplished the first part, but can´t solve the second one because the fifth spaceship hits me…How can I do to make my canon faster?

You can’t.
You shoot each turn and you must shoot the nearest enemy.

I´m pretty sure I´m shooting the nearest enemy…Still can´t find any error…

Read again this thread?
Send me your code?

How can I solve the tutorial?

It should be easy.
If you really need help, you should read again this tread and maybe these puzzles.

Help Me Please This code isn’t working and I don’t know why!

EDIT: Why can’t you read the numerous no full code in the above messages?

This code looks good to me. What problem are you experiencing?

1 Like

WOW I had an error message saying that enemy1 is not one of the enemies listed, but then I deleted everything and pasted it back in and now it works! Thanks for responding though!

I can’t do it!! I don’t know what to do :’(