   training a perceptron problem
  well I finally got my head round a perceptron and managed to get a simple one going in very rough code. so i decided to do it again from scratch unfortunately my second and neater attempt seems to train the perceptron wrong...so i dont have a good a grasp at it as i thought ive been at it all day and i need a fresh pair of eyes to help me iron out the problem if any of you would be so kindvoid CPerceptron::train( ){int isTraining = 0;while( isTraining < 1000 ){for( int i = 0; i < 4; ++i )// go though each training data sample of which are 4{float result = sum( i );result = stepFunction( result );//not producing the desired outputif( result != data.expected ){//this example is a little contrived and hard codeded//should find a better way to iterate through the weightsm_vecWeights[0] += ( data.expected - result ) * data.a;m_vecWeights[1] += ( data.expected - result ) * data.b;m_bias+= ( data.expected - result ); }}isTraining++;//increment}}any help would be appreciated cheersEDIT: disregard post... it was my sum algorithm i had a + where there should have been a * silly me   