Okay the problem is to find out the exact weekday after adding n days to the current day. E.g if today is Monday, after adding 1000 days it will be Friday (for example).
Here is my attempt, which obviously doesn't work.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
 
  | 
string weekDay :: add(const int _days) const{
	string weekday[7]={"Sat","Sun","Mon","Tue","Wed","Thu","Fri"};
	for (int i=0; i<7; i++){
		int j=i;
		if (weekday[i]==day){
			for(int k=0; k<(_days-i); k++){
				if (j==7)
					j=0;
				j++;
			}
		}
		return weekday[j];
		break;
	}
}
  |  | 
 
Note: weekDay is a class with one private member "day" of type "string".
Here is my algorithm:
1. Compare the string day with the array of strings weekday until a match is found.
2. When a match is found after "i" number of tries, we then add 1 to an int "j" which starts at 0. This is done "n" number of times, where n = number of days to be added - i.
3. If int "j" reaches a value above 6 (since there are 7 days in a week), reset it to 0.
4. Once the addition is finished, return weekday[j] and exit out of all loops.
I think my algorithm is correct, but am having trouble applying it. Any help would be appreciated, thanks.