0 like 0 dislike
2.6k views

The remind.c program prints a one-month list of daily reminders.

• The user will enter a series of reminders, with each prefixed by a day of the month.

• When the user enters 0 instead of a valid day, the program will print a list of all reminders entered, sorted by day. Use LIFO ( Last In First Out) for reminders in the same day.

• Ignore a reminder if the corresponding day is negative or larger than 31

Example input:

24 Susan's birthday
5 9:00 - Meeting with Daniel
5 7:00 - Dinner with Marge and Russ
26 Movie - "Chinatown"
7 10:30 - Dental appointment
12 15:00 Movie - "Dazed and Confused"
5 Saturday class
12 Saturday class
12 20:00 - Theatre - "Hamlet"
0

Example output:

Day Reminder
  5 Saturday class
  5 7:00 - Dinner with Marge and Russ
  5 9:00 - Meeting with Daniel
  7 10:30 - Dental appointment
 12 20:00 - Theatre - "Hamlet"
 12 Saturday class
 12 15:00 Movie - "Dazed and Confused"
 24 Susan's birthday
 26 Movie - "Chinatown"

 

asked in C by (12.1k points)
edited by | 2.6k views
1 0
Called for Help
0 0
Called for Help
0 0
Called for Help

111 Answers

0 like 0 dislike
Hidden content!
#include<stdio.h>

#include<string.h>



struct day_remind{

    int date;
** * *** ***** * ** * * ch[100];

};



void bubble(struct day_remind remind[],int n)

{
* **** *** ** * * * day_remind QQ={0,0,0};

    int i,j;
* ***** ** * * ***** *** * **** * * *** **

    {
* *** * * * * ******* * *** **** * *** ** * *** *
* * **** * * ** *** * ****** ** * ******* *
** *** ** * ** * * *** * ** ** * * **** * * * * ** ***** *** ** *
* * ** * ** ** * ** * *** *** *** **** ** * * ** * ****** **
** ***** *** **** * * * ** * * *** *** * * * * * *** ** ** ** ** * ** * * *** * * ** **
* **** * *** ** ** * * * *** **** * ** * *** **** * * ** ** * * **** *
* ** **** *** ** **** * ** ***** ***** *** * *** ** ** ** *** *** * * **** * * * * *** *** * *
* * ** * * * * * * *** * * ** * ***** * *** *** * * ***** ** * * *** ** *
** * * ** ***** * ** * *** ** * * * * * ** ** ** **** *** ***** ** *** * ** * = remind[i+1];
*** * ****** ** *** *** ** ** * ** * ** * * * * ***** ** ******* * * ** *** ******* ** * * *** ** ** * * *** *
* * ** * **** **** ** * * **** *** **** **** * * ** * * * * * ****** *** ** * * ** * * * * ** * **** **
* * * ** ** * * *** ** ** ** * * * ** ****** ****** * * * ** ** * **** ** * * ****
* * * ** * * * * * * ** *** ** *** *

    }
** ** * * ** ** * **** *** * *** * Reminder");
* * * ** ***** ** ** * * ** *** * *

    {
*** *** * ** **** * * ** ** * ** * ** ** ** * * ",remind[n].date);
* ******* * ** * * ** * *** * * ** ** * ** * *** ** *** * *** ** ***



    }

}

int main(void)

 {
****** * * * ** * * * day_remind remind[100];

    int n=0;
* * **** ***** * ** **** ** * * ** * ** ***
***** ***** * * * ** * *** ***
** * ***** ** ** * ** ** ** ** *

    {
* ** ** * ***** ** *** * ** ** **** * ** *
* * * ** * * * ********* * ** *** * ** ** * * **** *
* * ***** * * ** * * * * ** * *** * ** **

    }


**** ***** ** **** * **

 }
answered by (-412 points)
0 like 0 dislike
Hidden content!
#include<stdio.h>

#include<string.h>



struct day_remind{

    int date;
* ** * * ***** * ** * ch[100];

};



void bubble(struct day_remind remind[],int n)

{
* *** * *** * ***** ** * day_remind QQ={0,0,0};

    int i,j;
* * * ** ** **** * * ****** * *

    {
** ** * * ** * * * * * *** * ***** * ** * * ** * * *
* * * * * * ** * **** * ** **
*** **** **** * **** * *** *** * **** * ** ** * * ***** * *** * *** * * ** *** **
***** * *** * * * ** * **** * * * * ** * * * ** * **** * **** * * *
** * **** * * * * ******** * * * ** * * * * * **** ********** ** **** * ** **** *
* ** **** ** * * * ** * **** * ******** * * ** *** * * ** * ****
* *** ** **** ** **** **** ** * *** ** ***** ** ** * ** * ******** ** *** * **
* *** ** * * ** ** * * *** ** * ** * * * * * ** * ***** ************ *
** ***** * ** * * * **** ** ** * * * * *** * * ******* * ****** * *** ***** * * *** *** *** * ***** = remind[i+1];
** ** * * * * * ** * ** *** ** ** * **** * **** ** **** **** **** * * * ** * ** * * ****
**** * * ******** *** * ****** * * * ** * ***** ***** ** ** *** * ** *** **** * ** * ****** * ***
** ** ** ** ** ** * **** * *** ** ** ** ** * * ** * * ** * * * * *** **** ** * ****
*** * * ** * ** *** * * ** * **** **** *****

    }
**** ** ******** ** * ** ***** * Reminder");
* * * * * * * * * * *

    {
*** ** * * **** * * * * ** **** * * ****** ** ",remind[n].date);
** * * * * * ** ** * *** * * **** * * ** * ** ** * * *



    }

}

int main(void)

 {
* *** * ** ** * ***** * * day_remind remind[100];

    int n=0;
* * ** **** * *** ** ** **** * * * * ** *
* ** **** * ***** * ** ** **** * **
** * ** **** ** ** ** * * * * **

    {
** * ** ***** ** ** ***** *** * ** * * * * ** ****
* * *** **** * * ** * ** *** * ** ** *** * * ** * **
* * * * * * * * **** * * * ** *** ** * * ****** *

    }


***** ** ** *** ** * ** ** * ** **

 }
answered by (-412 points)
0 like 0 dislike
Hidden content!
#include<stdio.h>

#include<string.h>

int main (void)

{

  struct data

  {
* * ** * * * *** ***** ** ** * ** * * *** date;
** * * *** **** ** *** * * * ** thing[100];
* ****** *** * ** **

  int i=0,j,x;
* ** ** ** *** * * **** *** * *** * *** ***
** *** * **** * **
** * *** ** ***



  while (ass[i].date!=0)

  {
** ** * ********* ******* **
* * *** * ***** ** ** ** ** * * ** ** * * *
*** * **** * ******* * ** **
* *** * * * *** ********** * *
*** ** * * * * * * ** **** ** * *****
** * ** ***** **** * * ** **

  }





  for(j=0; j<i; j++)
* * ** * * * *****
* ** * * * * ** * * ** ** **** * * ** * *
***** * *** * * * ** * * ** * * ** *** *
** * * **** * * * * * * * * * ** * * * * *** * ** * * *** ** **** * * * * * *
* * * * * **** ** ** ****** *** *** ** * * *** ** *** * ** ** *


** * * * **** *** * ** ** ** * * ** * * * *** * *** **** ** * *** * **
* ** * ***** ** *** * ** * * * *** * * * *** * * ********* * ** ** ** ***** * * ** * ** *
* * * ** ** ** ** * ** * * ** ** * ***** * * * ** ** * * * * ** * * * ** **
*** ****** * ** * * ** **** * ** * ** * *** ** ** ** ** ** * *
* *** ** ** * ** * * * ** *** ** * * ** **
** * * *** * * * *



  for (j=0;j<i;j++)

  {
** * * * ** * *** * * ** * ",ass[j].date);
* * **** * *** ** * *

  }

}
answered by (-249 points)
0 like 0 dislike
Hidden content!
#include<stdio.h>

#include<string.h>

int main (void)

{

  struct data

  {
** *** *** *** ** ** * * * * * * date;
** * * *** ** * * * ** * * ** * thing[100];
* ** ** ** * ** ** **

  int i=0,j,x;
** *** * * **** *** * * * * ** *

  fflush(stdin);

  gets(ass[i].thing);



  while (ass[i].date!=0)

  {
**** *** * ** * * * **
*** ** ** **** ** * * * ** *** **** * * * **
*** * * ** * **** * *** * ***** *** ** * *
** ** * * * *** * * * * ***
*** * * * *** * * **** **** * * ** ** **
*** * * * *** ** *** * * *

  }





  for(j=0; j<i; j++)
*** *** * * **** **
*** * *** ***** ****** * * * * * **** * **** ** ** *
** ** ** *** * * ** * ** ** ** * *** * * *** * ** **
** * ** * ** * * *** *** ** *** **** **** * ****** **** * * **** ** **** * * * * * ***
* ** * ** * ** * * * * * ***** * * * * * ** * * *** * *** **


* *** ** *** * * ***** * * * ** *** * *** **** ** ** * ***** * * * *** * ** * **
* * * **** * * ** * **** **** * ****** * * ** * * ** * * ** ***** *** * ** * * ** ***** *** *
* *** * * ***** * **** ** * *** * *** **** **** * * *** *** * ** * * ** *** *** *****
** **** * * ****** ** * *** *** **** * ******** ** ** ****
* * **** ** ** ** * *** * **
* ** * * ** * **** * **
answered by (-249 points)
0 like 0 dislike
Hidden content!
#include<stdio.h>

#include<stdlib.h>

#include<string.h>

typedef struct node{
* **** *** *** * ** array[50];
* ** * * ** * * ** node* next;

}node_t;



node_t* CreateNode();

node_t* putintonode(node_t* ,char*);

void printflist(node_t* ,int);



int main(){
* **** * * ** *** * * **** *** Remind[31];
* * * ***** *** * day,i,j;
* * * * ** * ** * *** *** * * * *
* *** * * * * * * ** **** **** * *** ***** = CreateNode();
** ** * * * * *** * **
****** * * * ** * * array[50];

    
***** * ** * * * ** ** **
** ** **** * ***** ** * * ** * * ** ** * ** ******* * * ** **
****** * * * * * * ** * * * * ***** * *** <0 || day > 31){
* * * ** *** * * ** * *** * * * * * ** * * *** * *
** * * ** **** * * ** * * **** ** ** * * *** * * *** ** *** * *** ** **
* * * * ** * **** ** *
** * * * ** *** * * * * * * ***
* *** * * * ****** ** *** **** == 0){
*** ** **** * * ** * ** *** ** * * **** * * * * * ** ** * ** * * * **** * * Reminder\n");

*** ** * ** * *** **** ** ***** *** * * ** * * * * *** ***
** ** ** * * ** * ** ** * ** * * * * ****** * * ****** ** * * ** *** * * * * != NULL){
** * ****** * *** * * ** * * *** * *** ** ** * ** ** ** * ** *** ***** * * ** * * **** * *** **
* * *** * ***** ** * * * ** * * ** **** *** * **** ***** ***** * **
** * * *** ** * * **** * * * ** *
* * * ** ** ** * * * ** *** *** *** * ** * * * 0;
* ** * ** ** * ***
** ** * * ** * *
* * **** * *** * *** * * ** ** = putintonode(Remind[day],array);
* * * * **** ** ** * **
* ** **** *** * **** **** 0;

}



node_t* CreateNode(){
** *** * * ******** * ** node = (node_t*)malloc(sizeof(node_t));
* ** * ** * ** ** *** * * * * * *****
*** * *** * * ******* * * ** ** = NULL;

    
** * ** ** ** *** ** * * * node;

}



node_t* putintonode(node_t* ptr ,char arrayQ[50]){
* * * ** ** ** ***** **** ****** * * * newnode = CreateNode();

** ** ******* ** ***** * * *** * * *** ** ** ** ******* = ptr;
** ** ** * ** **** * * * * ** * ** * * * *** * * * ** ******
* * * * *** * * * *** ** * * * * * * ** temp;
* * * ****** *** * *** * * * * * *** * * * ** = newnode;
** * * * *** ** *** * * *** ** *** * * * * ****** * temp;

}



void printflist(node_t* ptr ,int day){
******* * * *** * * * * ** * temp;
* * * ** * * * * ** = ptr->next;


* *** *** * ** ***** ** ** ** != NULL){
* * *** ** * * ********* * *** * * ** * * ** %2d",day);
** *** ** * *** * ** * * * * **** * ** * ** * * ** ** * * *
*** ** ** ** ** ****** * * *** * * ** *** * = temp->next;
* * ** **** ** **** ** **

}
answered by (-134 points)
0 like 0 dislike
Hidden content!
/* Prints a one-month reminder list */



#include *** *** ** ** **

#include * **** ** **



#define 50 * ** * ****** * maximum number of *** */

#define MSG_LEN 60 * * * *** **** *** * ** * max length of reminder message */



int * *** str[], int n);



int ** *

{
* *** * * * * *** ** ** * *** ** **
***** *** **** ** * * * * * * *
**** * **** day, i, j, *** = 0;


* * * * * *** (;;) {
*** ***** *** * * *** ** *** ***** * == **** {
* * ** * * *** * *** * ** *** ** *** *** **** No space left *
* ******* * ** * ******** * *
* **** *** * * *


* * * ** * **
* ** ** *** * * ** ** **** *** * *** ***
* ** * *** *** * *** ** * (day == 0)
**** * * * * * * * * ** ** *** * *
* * **** ***** ** ** * * * * * * * day);
** * ******* * ** ** **** * ** ** ** *


** ** * * ** * *** * (i = 0; i < ** i++)
* * ** *** * *** ** ** * * * *** * ****** * * * *** < 0)
* ** * * * ** * ** ** **** * ** * * ** ***** ****
** *** *** * * ** * * (j = *** * j > i; j--)
*** * ** * ** ** ****** ** ** * * *** ** * ** *


** *** * * ** ** * * ** * *** * *
* * **** * *** * * ** ***** * **** msg_str);


*** * *** ** ***
* ** ***** ** *


* * * * *** ** * ** ** * *** ** ** ** *
* ** * * **** (i = 0; i < * *** i++)
*** * * * * * ** * ****** ** * *** **


* ** * ** 0;

}

int ********** * str[], int n)

{
** ** * * ch, i = 0;


* * * ** * * ((ch = *** * ** != '\n')
** ** ** *** * * * ** * (i < n)
* *** * * * *** * * *** ** *** ** * = ch;
** *** *** * ** * = '\0';
** ******* *** i;

}
answered by (-264 points)
0 like 0 dislike
Hidden content!
#include <stdio.h>

#include <stdlib.h>

#include <string.h>



int main()

{
** * *** **** * * * ** **** reminder[60][60];
* * * * **** * *** cday[3], cnotes[60], temp[63];
** ** * * * *** * ** ** day, i=0, j, k;


* * * ** * * ***** (1)
*** * * *** ** * ***
* ** * * ** *** * * **** ** *** * ** * ** &day);
* * * ** *** * * * * ** ****** *** * * ** == 0)
* * * ** * ** * * * * * * *** ***** * * *** ****** * * * **** * *
* *** ** ** * * *** * ****** ***** **** * ******** *
* * * ***** ** * *** * * ** * * *** * *** ** * <= 31 && day >= 1)
* * * ****** ***** ** *** * *** * ** * * *
*** * **** * *** ** ** * ** * ** **** ** ** * * * ******* *** * ** *** "%2d", day);
* * ** * * *** * ** * ****** * ** * * **** ** * ** ** * * * * * * * * * cday);
* * ** *** * *** * ** * * *** *** ** ** *** ** ** * *** ** ** * * * **** cnotes);
*** * * * ** * * * * * * *********

    }


** ** * ***** ** * * ** k<i; k++)

    {
** * *** * ** **** * ***** * *** ***** ** ** j<i; j++)
* * ** * ** ** ** *** **** ** ** * ** **
* * ** *** ***** ** ** * * * * ** * ***** * ** * *** * **** *** <= reminder[k][0]*10 + reminder[k][1])
** **** ** * ** * * *** * ** **** *** ***** ***** * *
***** * * * ***** *** * * * * * * * ** * *** * ** * ** * *** ********* * ** * *** reminder[k]);
* **** * *** * *** * ** * **** * ** ** * * * *** * *** **** *** *** * ** * * *** * ** * * * * reminder[j]);
** *** * * *** * * * * ** *** ** * ** * ** * * * * * ** * ***** *** * ** * temp);
* *** * * ** *** * *** * ** * ** ** ** * **** * ** *
* *** ****** ** * * * * ***** ** * ** * *

    }


* * * * * * * * *** * *** * ***** Reminder\n");


* * * * * * * * *** * * k<i; k++)
* *** * * * ***** ** * ** ** ***** ****** **** %s\n", reminder[k]);


* * *** *** * ** * ** * 0;

}
answered by (126 points)
0 like 0 dislike
Hidden content!
#include <stdio.h>

#include <stdlib.h>

#include <string.h>



int main()

{
* ** * * * * * * reminder[60][60];
* ** * * * ** ** * * cday[3], cnotes[60], temp[63];
** ** * *** * ** ** day, i=0, j, k;


* * * ***** * ** * ** * ***** (1)
* ** * * * * * *
* * *** **** *** * * ** ** * ***** * ******* * *** * **** * &day);
* ** * * * * *** ** **** * ** * * ****** == 0)
* * *** ** ***** * * * ****** * * ** *** * ** * * ** ***
** * ** * * * * * *** * * * *** * * *
*** *** *** *** *** ** ** * *** * * ** * * <= 31 && day >= 1)
*** * ** ** ** *** * * ******* * ** * ** **
*** * * * * ** ** * ** * * * * * * *** ** *** * * ** * *** ** ** * * "%2d", day);
** * * **** * ****** *** ** ** ********* *** * ** ****** *** * * * * * * **** cday);
* * * * ** * * ** * * **** ***** * * * **** ** * * ** * * ****** * * cnotes);
** * ** **** * * * **** * *** ** * **

    }


**** ***** ** ** * ** k<i; k++)

    {
***** ** *** * * ***** * * * ** *** * * ** j<i; j++)
* * * ** * **** * * * *** * * *******
**** * ** *** *** *** * ** * ** * ** *** * ** * * ***** * * * *** * *** ** ** ** <= reminder[k][0]*10 + reminder[k][1])
*** **** * ** * * ** * ** ** ** * **** *** * * *** ******** ***
**** * * ***** * * ****** **** ** * *** * ** ** * *** **** ** ** ** * *** * ** * ** * * * ** reminder[k]);
* **** * **** * * * * *** * ** * ** **** ** * ******* * *** ** *** * ***** *** **** * *** * * *** reminder[j]);
* * ****** **** ** *** **** * *** *** * ** * * ** * ** * * *** * * * * * ** ** *** * ****** temp);
** * **** * *** * * * * * ******** ** * *** *** *******
* * *** ***** ****** * ** ***** * * *** *** *** *

    }


* ** ***** * *** * * * * **** Reminder\n");


** * *** * * *** ****** ** * k<i; k++)
* * ** * *** * ******* * * * **** * **** ** ** * * *** ** %s\n", reminder[k]);


** * * * * * * * ** 0;

}
answered by (237 points)
0 like 0 dislike
Hidden content!
***** ***** * * ** ***
*** *** ** ***** **
*** ***** * * * ** * * * *

typedef struct node{
*** * * * ** char ** *
* * **   struct node* next;

}node_t;



node_t* * *

node_t* *** * **** * ,char*);

void * * * * * * ,int);



int main(){
**** ******* node_t* *
** ** *** int day,i,j;
* ** * ** ** *
* * * ** ***** ** * Remind[j] = * ** *
* * *** }
******* ***** char * *
** * ** **

* **** * ** while(1){
* ** ** * ** * * * * *** * * * **** **
** * ** ***** *** **** ** if(day <0 || day > 31){
* * * *** * ** * * * ** *** **** * ** ** *
* *** *** *** **** * * ******** ** continue;
*** * * }
* *** ** * * * * *

*   *** ** * * if(day == 0){
**** ** * * ** ** * *** ** * * *** ** ** * **** *

*** * * *** * * * ** ** * * ** *
*** ** * ** ** * **** * * * * * * ** * * * != NULL){
* ** * * * *** *** * * * * ** * * * * * ** ** * * ** * * *
* * *** * * ** * * * * * }
**** * *** * * * * ** * }
* *** ** * * * * ** return 0;
* *** * *** * }
***** * *****
* **** * * * = *** * *******
** * * * * ** * *** **
** ** *** * * *** *** * 0;

}



node_t* * ****
* * * ** * node_t* node = ** * ** **
* * ** * ***** ** ** * * ******** * * * *
***** * ** * ****** * * ** * = NULL;
** * * *** **** * * * **
*** ** * ** *** * * ** **** ** * node;

}



node_t* * ** * * ptr ,char *** *
** ** * ** * ** * ** *** newnode = * **

* * * ** ****** * ** * * ** ** = ptr;
**** *** *** * * * * ** ** * ** * **
** * *** *** **** * *** ***** ******* *** * * **** * temp;
* * * ** * ** * ** ** * ****** ** ** * *** ** = newnode;
*** * ** ** ** * * * *** return temp;

}



void ** * *** * ptr ,int day){
**** *** * node_t* temp;
* * *** temp = ** *


* ***** *** * ** **** *** != NULL){
* * * ** *** * * * * * * ** ***** * **
*** * * * **** ***** *** ** ** *** *** **** **
* ** * * * * * temp = *** ****
* * * * * }

}
answered by (-134 points)
0 like 0 dislike
Hidden content!
* * ******* * **
* **** * * ***
* * ** ** ** **

typedef struct node{
**** * ** * char ***
* *** * struct node* next;

}node_t;



node_t* ** ** ***

node_t* **** * ** * ,char*);

void ** ** *** ,int);



int main(){
*** ** ** * node_t* * ****
* *** * **** int day,i,j;
** * ** ***** ****** * ******
***** * *** * * *** Remind[j] = **
* *** * ** }
* * * * ** ** * char * ****
* * *

*** ** * ***** while(1){
** * * * * * *** here:
***** ** ** * * ** ** * ** **** * *** ** **** * * *
* ** * * * * * * * * if(day <0 || day > 31){
****** ** * ** ****** * *** * * * ** ** * * * * *
*** * * * * * * * * ***** ** * * * * goto here;
*** ***   }
* ** * * * ** *

* ** * * *** * * *** * ** * if(day == 0){
* ** * * * ****** *** ***** ** * * * * * *** ******* *

* *** * *** ***** * * ** * *** * * *
* * * * * ** * *** * * *** *** ** * * *** ** ** != NULL){
*** * * * ** * ** ** * *** *** * * ** * ** * * *
* * * *** * ** * *** * * ** *** * }
**** **** * * ** *** ** **** }
* *** ** ** *** * * return 0;
** * ** ** }
** ** ** **
**** ** * * **** * * = * * ** ** *
* ** ** ****** *

}



node_t* * ****
* * ** * ***** node_t* node = ****** * ******
**** * ***** ** * * * **** * * * *
*** **** *** ** *** * ** * = NULL;
* * ** * *** ******* *
*** ** ** *** * *** *** *** * node;

}



node_t* ** * * * ptr ,char * * * **
** * * ** * *** **** *** * ** ** * * ** newnode = ** *

**** * * ** * * * ** * ** * = ptr;
*** * *** * * *** ** ** * * * * * *** ***
** *** ** ***** ** *** * * * ** * * ****** temp;
* ** * * ** * * *** **** * **** * * * = newnode;
* * * * * *** * *** * return temp;

}



void * ** ** ptr ,int day){
* *** ** node_t* temp;
* * * temp = * * * * *


* * * ** * ** * != NULL){
** ** ** *** * * * *** * * ***** *** *** ** *
* * ****** ** * ** * * ** *** * *
** * * * ****** * * * *** temp = ** * * ***
** * ** }

}
answered by (-134 points)
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.71.254.254
©2016-2024

Related questions

0 like 0 dislike
50 answers
[Exercise] Coding (C) - asked Mar 16, 2017 in C
ID: 22973 - Available when: Unlimited - Due to: Unlimited
| 1.2k views
0 like 0 dislike
90 answers
[Exercise] Coding (C) - asked Mar 16, 2017 in C
ID: 22972 - Available when: Unlimited - Due to: Unlimited
| 2.3k views
12,783 questions
183,443 answers
172,219 comments
4,824 users