Error message: expected constructor, destructor, or type conversion before '(' t

Here is my code, which got the error message shown below and in the subject heading.

int inputpin = 0; int outputpin = 1; pinMode (inputpin,INPUT); pinMode (outputpin,OUTPUT); digitalWrite (outputpin,LOW); while (digitalRead(inputpin)==0) {} digitalWrite (outputpin,HIGH); delay (1); digitalWrite (outputpin,LOW); while (true);

Error message: expected constructor, destructor, or type conversion before '(' token

I believe it says the problem is in lines 4-11. Any ideas? I'm lost

It may want a semicolon in the empty while?

while (digitalRead(inputpin)==0) {}

This is what I normally do:

while (digitalRead(inputpin)==0)
     ;

Where is setup? Where is loop?

Based on what you have posted, it is impossible for us to help you. Post your actual code and we might actually be able to help.

(BTW, there is nothing wrong with this while (digitalRead(inputpin)==0) {}).

Where would I put setup and loop?

Between code tags if you want any help

Look at any of the dozens of examples on the Arduino home page like this one:

singha: Any ideas? I'm lost

All your executable code needs to be inside functions.

You need to define at least the functions setup() and loop().

I suggest you look at and run some simple example sketches and understand how they work do before you try to write your own, because you do need to have at least some grasp of the C++ language syntax before you write code.