How to parse a date
-4 Votes
Posted 2 years, 9 months ago
1: char[7] textbox ; 2: 3: int one, two, three ; 4: char[3] temp ; 5: 6: temp[0] = textbox[0] ; 7: temp[1] = textbox[1] ; 8: temp[2] = 0 ; 9: one = atoi(temp) ; 10: 11: temp[0] = textbox[2] ; 12: temp[1] = textbox[3] ; 13: two = atoi(temp) ; 14: 15: temp[0] = textbox[4] ; 16: temp[1] = textbox[5] ; 17: three = atoi(temp) ; 18: 19: // And you might think that's bad, but here comes the greatest line in the history of programming: 20: 21: if ( three > 70 ) { three = three + 1900 } 22: else { three = three + 2000 } 23: 24: // I kid you not
From Anonymous
Posted 1 month, 1 week ago
Bug of 2070...
