need help with homework

hi and tnx to anyone who can help.
I need to write a code that will display on the serial monitor my name then my SSN (social security number). on the same line.
then go one line down and display HEX DEC BIN and OCT.
then it will go one line down and start counting in all of these bases but only after 3 presses of a button
and a 1-second delay can anyone show me what's wrong with my code because right now it will only count after one press and I need three, the delay works fine.

this is my code, it is set for one press of the button and a 1-second delay

int x=0;
void setup() {
Serial.begin (19200);
Serial.print ("SEAN FERTOUK");
Serial.print ("\t");
Serial.print ("SSN");
Serial.print ("\n");
Serial.print ("DEC");
Serial.print ("\t");
Serial.print ("BIN");
Serial.print ("\t");
Serial.print ("OCT");
Serial.print ("\t");
Serial.print ("HEX");
Serial.print ("\t");
Serial.print ("\n");
}
void loop () {
while (digitalRead (2) == 0);
x++;
Serial.print (x,DEC);
Serial.print ("\t");

Serial.print (x,BIN);
Serial.print ("\t");

Serial.print (x,OCT);
Serial.print ("\t");

Serial.print (x,HEX);
Serial.println ("\t");

while (digitalRead (2) == 1);
delay (1000);
}

this is the code if anyone can help tnx

How is your button wired up?

WELCOME to the wonderful world of Arduino's

please take a minute to read HOW TO USE THIS FORUM

it used to be one of the pinned links on every forum page, but today it seems that it is not a link, had to go into a different link to find it.

#6 talks about how to write a subject line that is useful. please read that .
#7 shows how to post code.

you can edit your first post by going to the bottom right, hit other modify

seanfertouk:
can anyone show me what's wrong with my code because right now it will only count after one press and I need three,

There is no attempt in the program to check for multiple button presses.

To do that you need to check when the buttonPin changes from not-pressed to pressed, and repeat that as often as needed

...R

seanfertouk:
then it will go one line down and start counting in all of these bases but only after 3 presses of a button
and a 1-second delay

So you need to count *debounced *button presses. You'll need a variable to store the count value and some code to do the debouncing (there are libraries for this). Lots of info in the first five demos in IDE -> file/examples/digital/

It's not stated explicity but, one of the biggest points to get from this is how to do several things at the same time