Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <stdlib.h>
- #define length 30
- int main(){
- //Initialize variables
- int temp=0;
- int x=0;
- int y=0;
- char tempChar[length];
- char myString[length];
- char *reminderPtr;
- int day[length];
- char myReminders[length][length];
- while(strcmp(myString,"0")!=0){
- //Ask user for the reminder
- printf("Enter day and reminder: ");
- gets(myString);
- //Cut off the ending reminder
- reminderPtr= strtok(myString," ");
- x=atoi(reminderPtr);
- printf("%d\n",x);
- day[y]=x;
- strcpy(myReminders[y],myString);
- y++;
- }
- for(int a=0; a<length; a++)
- {
- for(int b=0; b<length-1; b++)
- {
- if(day[b]>day[b+1])
- {
- int temp = day[b+1];
- day[b+1] = day[b];
- day[b] = temp;
- }
- }
- }
- for(int v=0;v<length;v++){
- if(day[v]>0)
- printf("%d\n",day[v]);
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment