Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
1.78/5 (6 votes)
See more:
C#
Array carPark[10][2];
                    String carName;
                    String carPlate;
                    for int i = 0;i < size of carPark; i = i+1
                    for int b = 0;i < 2; b = b+1
                        carPark[i][b] = "empty";
                    // When guest comes
                    carName = Userinputs name;
                    carPlate = User inputs plate;
                    for int i = 0, i< size of carPark; i = i+1
                    for int b = 0; b<2; b= b+1
                        if carPark[i][b] ==/equals to "empty"
                    carPark[i][b] = carName;
                    carPlate[i][b+1] = carPlate;
                    return "Car has bee placed at space " + i
                    return "No empty spaces left"
                        // When guest leaves
                    for int i = 0, i< size of carPark; i = i+1
                    for int b = 0; b<2; b= b+1
                        if carPark[i][b] ==/equals to carName
                            carPark[i][b] = "empty"
                    carPark[i][b+1] = "empty"
                    return "Car has bee placed at space " + i
                    return "Car not found"
Posted
Comments
PIEBALDconsult 3-Nov-14 14:41pm    
It doesn't look like it would compile; you're missing a lot of punctuation, this isn't VB.
I'll start you off with "a for statement requires parentheses" and you can take it from there.

This definitely looks like something other than C#; it will require a lot of work just to get it to compile, and there are other problems as well, like IndexOutOfRange.
If you're going to try to plagiarize code for your homework, you should at least get it in the language of your choice.
Sergey Alexandrovich Kryukov 3-Nov-14 14:47pm    
...so, the question does not make any sense. Also, such question make sense only if you explain what are you trying to achieve, what seems to work not as you expected, and so on.
—SA

1. Whats wrong: The code contains pseudocode where you are supposed to fill in essential code lines.
2. Why doesn't it run: It doesn't run, because it is not valid C# code.

BTW: It isn't even a complete program. so why should it run?

Cheers!
 
Share this answer
 
Well, the major reason is that the compiler doesn't understand it.
And until it does, your program doesn't even exist as an executable file.

It's as if a Japanese speaker had sat down in your living room and started speaking random words of English: you understand each word, but the order and context make no sense, so there is nothing you can do except try to make him understand that you don;t know what he is talking about.

Stop what you are doing, go back to the beginning of your course, and start looking at the syntaxt of C# and what each statement does.
Almost every single line of that has a problem (and the ones that don't are mostly comments): so you need to go right the way back to the fundamentals and start thinking again about how to write correct code!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900