I am having a little issue with the sleep() function and was hoping someone might be able to explain what’s happening.
Although the code seems fine and runs ok, when the sleep function is added it seems to do all of the sleeps first before printing the certificate text.
void congratulateStudent (char *student, char *course, int numDays)
printf("%s has done as much %s Programming as I could fit into %d days.", student, course, numDays);
int main(int argc, const char * argv)
congratulateStudent("Mark", "Cocoa", 5); sleep(2); congratulateStudent("Bo", "Objective-C", 2); sleep(2); congratulateStudent("Mike", "Python", 5); sleep(2); congratulateStudent("Ted", "iOS", 5); return 0;
In the output frame it does return all the text but only after a 6 second wait. It doesn’t wait two seconds ‘between’ each line.
Also I have noticed on some other screen prints posted here there is a return between each line, whereas mine is one long sentence!
I’m not sure if it matters but I am running what appears to be Xcode 4.3.3
Any help would be much appreciated.