alarm clock

Hi I'm making an alarm clock with arduino. I have lot's of tilt switches which i can get to work but what i'm having most trouble with is getting it to set the time forward. Can any one help put me in the right direction with it i'd be really grateful. I'm fairly new with this still.

Here is some of my code so far

#include <LedControl.h>
#include <WProgram.h>
#include <Wire.h>
#include <DS1307.h>

LedControl lc=LedControl(12,11,10,1); // the pins on the MAX7219 driver chip

int a; //hours
int b; // hours
int c; // minutes
int d; // minutes
int e; // seconds
int f=0;

int set_hours = 0; // section of programme for setting the hours
int set_minutes = 0; // section of programme for setting the minutes

int g = a;
int h = b;
int i = c;
int j = d;

int x = 0;

int tilt1 = 2; //
int tilt1val=0;
int tilt2 = 3; //
int tilt2val = 0;
int tilt3 = 4; //
int tilt3val = 0;
int tilt4 = 5; //
int tilt4val = 0;
int tilt5 = 6;
int tilt5val = 0;

boolean DP;

void setup(){
Serial.begin(9600);

lc.shutdown(0,false); // this sectioin of code controls the intensity of light on the 7 segment display
lc.setIntensity(0,8);
lc.clearDisplay(0);
Serial.begin(9600);

RTC.stop();
RTC.set(DS1307_SEC,1); //set the seconds
RTC.set(DS1307_MIN,50); //set the minutes
RTC.set(DS1307_HR,15); //set the hours
RTC.start();

pinMode(tilt1, INPUT); // tilt 1 is the the tilt switch connected to pin 2
pinMode(tilt2, INPUT); // tilt 2 is the tilt switch connected tp pin 3
pinMode(tilt3, INPUT); // tilt 3 is the tilt switch connected to pin 4
pinMode(tilt4, INPUT); // tilt 4 is the tilt switch connected to pin 5
pinMode(tilt5, INPUT); // tilt 5 is the tilt switch connected to pin 6
}

void loop(){

tilt1val = digitalRead(tilt1); //read tilt 1
tilt2val = digitalRead(tilt2); // 2
tilt3val = digitalRead(tilt3); // 3
tilt4val = digitalRead(tilt4); // 4

int hrs = RTC.get(DS1307_HR,true); // calculate hours
int mins = RTC.get(DS1307_MIN,false); // minutes
int secs = RTC.get(DS1307_SEC, false); // seconds

a = hrs / 10; // a is hours on digit 0
b = hrs % 10; // b is hours on digit 1 % sign is modulo which is the remainder of a
c = mins / 10; // c is minutes on digit 2
d = mins % 10; // d is minutes on digit 3 % sign is modulo which is the remainder of c
e = secs % 2;

if (e == 0){
DP = true;
}

else{
DP = false;
}

if (tilt1val == HIGH){

for ( j==d; j < 10 ; j++){
lc.setDigit(0,3,j,false);
delay(100);
if(j==9 && i < 6){
i=i+1;
lc.setDigit(0,2,i,true);
}
else if(j==9 && i==5 && h<5){ // when z =9, y =5 and x =5 run this part of program
i=0; //
h=h+1; //
lc.setDigit(0,2,i,true); // using driver 1, y is digit 2
lc.setDigit(0,1,h,true); // using driver1, x is digit 1
}
else if(j==9 && i==5 && h==5 && g<9){
i=0; //reset y to 0
h=0; // reset x to 0
j=j+1; // reset z to z + 1
g=g+1; // reset w to w+ 1
lc.setDigit(0,0,g,false); //first driver, digit 0, w is minutes
lc.setDigit(0,1,h,true); //first driver, digit 1, x is tens of seconds
lc.setDigit(0,2,i,true); //first driver, digit 2, y is
}
else if(j==9 && i==5 && h==5 && g==9){
i=0;
h=0;
j=0;
g=g++;
lc.setDigit(0,0,g,false);
lc.setDigit(0,1,h,true);
lc.setDigit(0,2,i,true);
lc.setDigit(0,3,j,false);
}
}
}

else if (tilt1val == LOW)
{
lc.setDigit(0,0,a,false); //first driver, digit 0, a is hours
lc.setDigit(0,1,b,true);
lc.setDigit(0,2,c,true);
lc.setDigit(0,3,d,false);
delay(1);
}
}

It count's up to 19 and that's as far as i can get it to go

for ( j==d; j < 10 ; j++){

I think you want "j = d" here, not "j==d".

Thank you

I've changed it as i had a stopwatch function that worked earlier so i ahve copied and pasted and changed parts from that (see below) the next problem i'm having is getting it to store the value i'm changing it to. can anyone help me with that?

#include <LedControl.h>
#include <WProgram.h>
#include <Wire.h>
#include <DS1307.h>

LedControl lc=LedControl(12,11,10,1); // the pins on the MAX7219 driver chip

int a; //hours
int b; // hours
int c; // minutes
int d; // minutes
int e; // seconds
int f=0;
int set_hours = 0; // section of programme for setting the hours
int set_minutes = 0; // section of programme for setting the minutes
int w = a;
int x = b;
int y = c;
int z = d;
int tilt1 = 2; //
int tilt1val=0;
int tilt2 = 3; //
int tilt2val = 0;
int tilt3 = 4; //
int tilt3val = 0;
int tilt4 = 5; //
int tilt4val = 0;
int tilt5 = 6;
int tilt5val = 0;

boolean DP;

void setup(){
Serial.begin(9600);

lc.shutdown(0,false); // this sectioin of code controls the intensity of light on the 7 segment display
lc.setIntensity(0,8);
lc.clearDisplay(0);
Serial.begin(9600);

RTC.stop();
RTC.set(DS1307_SEC,1); //set the seconds
RTC.set(DS1307_MIN,50); //set the minutes
RTC.set(DS1307_HR,15); //set the hours
RTC.start();

pinMode(tilt1, INPUT); // tilt 1 is the the tilt switch connected to pin 2
pinMode(tilt2, INPUT); // tilt 2 is the tilt switch connected tp pin 3
pinMode(tilt3, INPUT); // tilt 3 is the tilt switch connected to pin 4
pinMode(tilt4, INPUT); // tilt 4 is the tilt switch connected to pin 5
pinMode(tilt5, INPUT); // tilt 5 is the tilt switch connected to pin 6
}

void loop(){

tilt1val = digitalRead(tilt1); //read tilt 1
tilt2val = digitalRead(tilt2); // 2
tilt3val = digitalRead(tilt3); // 3
tilt4val = digitalRead(tilt4); // 4

int hrs = RTC.get(DS1307_HR,true); // calculate hours
int mins = RTC.get(DS1307_MIN,false); // minutes
int secs = RTC.get(DS1307_SEC, false); // seconds

a = hrs / 10; // a is hours on digit 0
b = hrs % 10; // b is hours on digit 1 % sign is modulo which is the remainder of a
c = mins / 10; // c is minutes on digit 2
d = mins % 10; // d is minutes on digit 3 % sign is modulo which is the remainder of c
e = secs % 2;

if (e == 0){
DP = true;
}

else{
DP = false;
}

if (tilt1val == HIGH){
for( z=0; z<10;z++){
lc.setDigit(0,3,z,false); //first number is driver, second is digit (0-3)
delay(100); // time delay
if(z==9 && y < 5){ // when z=9 knock onto digit 2 and when y=5 knock onto digit 1
y=y+1; // start count again
lc.setDigit(0,2,y,true); // starts count up on digit 2

}
else if(z==9 && y==5 && x<9){ // when z =9, y =5 and x =5 run this part of program
y=0; //
x=x+1; //
lc.setDigit(0,2,y,true); // using driver 1, y is digit 2
lc.setDigit(0,1,x,true); // using driver1, x is digit 1
}
else if(z==9 && y==5 && x==9 && w<2){
y=0; //reset y to 0
x=0; // reset x to 0
z=z+1; // reset z to z + 1
w=w+1; // reset w to w+ 1
lc.setDigit(0,0,w,false); //first driver, digit 0, w is minutes
lc.setDigit(0,1,x,true); //first driver, digit 1, x is tens of seconds
lc.setDigit(0,2,y,true); //first driver, digit 2, y is
}
else if(z==9 && y==5 && x==3 && w==2){
y=0;
x=0;
z=0;
w=0;
lc.setDigit(0,0,w,false);
lc.setDigit(0,1,x,true);
lc.setDigit(0,2,y,true);
lc.setDigit(0,3,z,false);

}
}
}

else if (tilt1val == LOW)
{
lc.setDigit(0,0,a,false); //first driver, digit 0, a is hours
lc.setDigit(0,1,b,true);
lc.setDigit(0,2,c,true);
lc.setDigit(0,3,d,false);
delay(1);
}
}