Arduino Uno pins acting strangely

Hello there! Sorry to drop in first post begging for help, but I just bought an Arduino Uno (R3 of course) and noticed something very strange when I configure pins as inputs.

Earlier, I tried wiring the 3v3 pin to a button to an input pin (this seems to happen with every pin on the headers, perhaps with exception of RX/TX and 13), setting an LED between pins 12 and GND, and running this program to repeat the input signal over the LED and serial.

int inpin = 8;
int outpin = 12;
void setup() {
 pinMode(outpin,OUTPUT);
 pinMode(inpin,INPUT);
 Serial.begin(9600);
}
void loop() {
  Serial.print(digitalRead(inpin));
  digitalWrite(outpin,digitalRead(inpin));
  delay(10); //stability delay
}

The circuit ought to have a pretty obvious effect - hit the button, light turns on, 0 spam turns to 1 spam in the monitor, and vice versa when the button stops contacting. This isn't the case, however - the output is very erratic. If I touch/poke/bend the input wire while not connected to a power source, or if some subtle seismic force such as bumping my desk or getting up from my chair near the Arduino moves the input wire in just the right way, the input pin will return true for a moment or oscillate, depending on the movement.

I went ahead and wrote up a debouncer, but there are further problems with the input. If I wire the circuit up correctly as aforementioned and carefully press the button without jerking the input wire, then the circuit will still work as intended, except for one thing: the input has a tendency of holding true without input oscillation for anywhere ranging from 200ms to 5 seconds before finally turning off, completely thwarting any debouncing method I can come up with.

What's the issue with the Arduino here? I've absolutely no clue if this is some quirk with the Arduino boards (i certainly hope not, the R/C builders would've staged a mutiny by now!) or if this is a unique defect to this board in particular, but I'd certainly appreciate knowing what's wrong with it.

Thanks in advance!

The key term is "floating pin"... https://www.google.com/search?q=site%3Aforum.arduino.cc%20floating%20pin

http://www.thebox.myzen.co.uk/Tutorial/Inputs.html http://gammon.com.au/switches

Interesting… Not much experience with this kind of stuff, as you can tell. Thanks a lot for the links and info, hopefully I can work around this.

bclindner: hopefully I can work around this.

It's not so much a workaround as SOP.... make the pin high or low with an external pullup or pulldown resistor, or high with the internal pullup, then your pin will always be at a known state.