if you are just doing dates in that format try
int name[/*number of dates here*/][3];
if you want some code a friend threw this at me but i have not gotten to really test it out.
edit: i removed the code, it did not work. try setting an equal array.
1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
myarray[21][3] = newarray[21][3];
bubblesort( newarray , 21);
for(int i = 0; i < 21; i++){
for(int j = 0; j < 21; j++{
if(myarray[i][0] == newarray[j][0]) {
for(int l = 0; l < 3; l++){
if((myarray[i][2] == newarray[j][2]) && (myarray[i][3] == newarray[3])) break;
else myarray[i][l] = newarray[j][l];
}
}
}
}
|
this sorts the first number and then based on the first number and an if statement to make sure there are no repeats assuming there are no repeats in the data.
this is simple enough without getting into long algorithms. if you want strings you need to convert them into a number i would suggest converting the dates into days before year 0.
for example
total_days = days + (months *30) + ((years*1000) * 365);
note that you do not need to account for leap years and months that do not have a length other than 30 because the conversion is consistent.
this will give a good number to set values and organize in that method.