0 like 0 dislike
3.7k views

Write a program that prompts the user to enter two dates and then indicates which date comes earlier on the calendar (m/d/yyyy):
 Sample input:

3/6/2008
5/17/2007

Sample output:

5/17/2007 is earlier than 3/6/2008

 

Sample input:

3/6/2007
5/17/2008

Sample output:

3/6/2007 is earlier than 5/17/2008

 

Sample input:

3/6/2007
3/6/2007

Sample output:

Same day!

 

[Exercise] Coding (C) - asked in C
ID: 22673 - Available when: Unlimited - Due to: Unlimited

edited by | 3.7k views
0 0
Called for Help

56 Answers

0 like 0 dislike
Hidden content!
#include **** *** ** **

#include * * * *** * *



int main()

{
** **** ** ** * * * ** * a[3], b[3], i;
* ****** ** *** ***** *** ** * ** ** &a[1], &a[2], **** * **
* *** ** * * ****** * ** * ** * &b[1], &b[2], &b[0]);
* **** **** ** **** ****** * ** i<3; i++)
*** ***** ** * ** *** * **
** * * ** *** ** ** * * **** * * * * ** * ** * *
* ** ****** * * * ***** * * * **** * ** ** *
** ** ***** ** ** * *** ** **** ** *** ** *** ** *** ** ****** *** ** * is earlier than ** *** ** b[1], b[2], b[0], a[1], a[2], a[0]);
***** * *** ** *** ** ** * * * * * **** ** * ** * * * *** **
* * * * * ** * * * ***** * * * ****
** * * * * * **** *** ** * * ***** * ** ** * * *** *** is earlier than ** ** *** a[1], a[2], a[0], b[1], b[2], b[0]);
* **** ** * *** **


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

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



int main()

{
** *** * ** **** * day, month, year, day1, month1, year1;
** * ** * *** *** ** * *** **** * *** *** ** ****** ****** *******
** *** ** * ** *** * * *** **** *** * * **** ** ** * * * ****** * ***
* ** ***** * ** * * ** (year1 ** year)
** * *** * ** * ******** *** * ******* ** *** *** * **** * * is earlier than ** * ** ** month1, day1, year1, month, day, year);
*** ** ****** ** ** ****** if (year1 == year)
* * * **** * * *** ** *
* **** ** ** * * * ** ** * ** * * * * *** ** ** * * (month1 ** * month)
* * *** ** *** ** *** * **** * ***** *** *** * * ** *** **** *** ***** * * * ** * ** is earlier than * ** *** * **** month1, day1, year1, month, day, year);
******** * ** ** * * * * * *** ** ** * *** ** if (month1 == month)
* ** * ** * * * * ** * * * * *** * ******** ***
* * *** *** ** * * ** * * * *** ** ***** * * *** * ** ** (day1 * *** day)
*** **** * * * **** * * * * * * * ** * * ** ** * ** * *** * *** * * * * * **** ** * **** is earlier than * ** * *** **** day1, year1, month, day, year);
** ** * ** * * ** * * *** * **** ** ** * * ***
* ** * *** * ** * * * * * ***** * * ****** ** * ** * **** ** ****** ** *** ** * *** * ** *** ** * ***** ** is earlier than ** ** ***** month, day, year, month1, day1, year1);
** * * ** * * * * * * ****** ** ** ** * *
* ** * * ** **** ********* * * ** ** ** ** **
* * * ** *** * * * * * ** **** **** * ** ** * ** * * * *** * * ** * *** ** ** * is earlier than * ** *** ** month, day, year, month1, day1, year1);
* * * ** * ** * ***
** * * *** ****** **
** ** *** * * ** ** * * ** * *** ** **** * * ** * * is earlier than ** ***** month, day, year, month1, day1, year1);
* * **** * ** *** * **** *** 0;

}



// * ** * * ** * * is earlier than *** * ** day, month, year, day1, month1, year1);
answered by (-218 points)
0 like 0 dislike
Hidden content!
#include<stdio.h>



int main(void)

{
* * * *** ** * ** * * month1,date1,year1,month2,date2,year2;
** ** * * * *** **** * * * ** * ** ** * ***** ** * *** **
* * ***** ** ** * ** * *** * * * * *** * **** * * ** *


* * ** *** *** * * * ***** * ** *
*** *** *** * ****
***** * * * * ** *** ****** * ** * ** * ***** *** * * ** * * * * * is earlier than * * * **** ***** ** *** ***** **

    }
** ** * ** * * **** ** ** if(year2>year1)

    {
* * * * ***** * ***** ** * * ** **** * * * * *** is earlier than * *** ** * ***** *** ** ****** ***
** ** ** ** ** ** *** *
* * **** * * * **** * if(month1>month2)
***** * * * * * *** ** *
* * *** * * * ** ****** ** *** * * *** ** ***** ***** is earlier than * * ** * ** ** *** ** * * * *
** * ** * * *** * ***
** * * * *** *** * ** if(month2>month1)

    {
* ** * ** * ** * * *** ** * ** **** ** * * *** is earlier than * * * ** * * *** * **
* * *** * * ** **** **
*** ** ** * * ** * ** if(date1>date2)
* * *** *** * * * ****
* * *** ** * ** * ** * * **** * **** * **** * *** ** * * * is earlier than ** * ** ** * * * * ** *** **** **
* * * ** * * ** **
** * ** ** ** * if(date2>date1)

    {
****** * *** * ** * * * ** * ** ** *** * **** * * *** is earlier than * ** ** * * * ** **
* ** *** * * ** ** ****
** * ******* ** * * * ***
* * **** * * * * ** ** *
* *** * * ** * ** ** * ** * ** * * *** ** ***** *** * Day!");
* *** ** **** *** *

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



int main(void)

{
* * *** * ** * * ** *** * * month1,date1,year1,month2,date2,year2;
* ** * **** ** * ** *** ** ** * * * * * ** ***** * * ** * ********
* * * * * ** ** ****** ** **** ** * ** *** ** **** * *


*** * * ** * * * ***** * ** ***
** *** * * *
** * **** * * ** ** * * ** * * *** * * * *** *** is earlier than *** * * ** ****** * * *
* * ** *** ** ***** *
******** * **** ***** * if(year2>year1)

    {
*** *** * ** *** * * ** ** * ** **** * * * * * ** is earlier than ******* * ** * *** * * * * * ****
** **** * * * * ** ***
*** * * * **** * if(month1>month2)
* ** * **** ** * ** * *
** ** **** ** ** ** *** * * ***** * * * * * * is earlier than * *** **** ** * * ** ** *** *
* ** **** ** ***
*** * * * * * ****** ** * if(month2>month1)
***** * ***** **
*** ** * *** ** * *** ** ** ***** ****** ******** *** * *** * ** is earlier than * **** *** ** *** ** * ** *** ** *
* * * * * *
** ** ** ** ** ** * ****** if(date1>date2)
** * * * * * * * * ** **
******* * ** * *** ***** ** ** * ** ** * * ******** * is earlier than ** * *** * * * * ** ** *

    }
** * ** * ** **** * if(date2>date1)

    {
** * * * * * * ** * * * ** ** ** *** * * * is earlier than ** * * ** * ** * ** * *
** ** ** ** ** * *** ** * *

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

#include<string.h>



int main ()

{
* * * ** ** * **** * y1,y2,m1,m2,d1,d2;
* ***** ** * ** *** *** * ** * ** ** *** * * * * *** *
* * * * *** * * * * ** ** * ***** *** *** ** *** * ******
** ** * ** **** * ** ** **** * *
* * *** *** * * *** * *
** * ****** * **** * * * * * ** *** *** * is earlier than %d/%d/%d",m2,d2,y2,m1,d1,y1);
* ** ** * ** * ***
* * *** *** **** * if(y2>y1)
** ** ***** * * ** * *
* ** ********** ***** ***** * * *** ** * * is earlier than %d/%d/%d",m1,d1,y1,m2,d2,y2);
** ** * ***** * *
* * * * * ** ** * * if(y1==y2)
** ** * *** ** ** * ** ** ****
* ******** ** **** ** *** *** ***** * * * **** *
* ** * ********* * * * *** *** ** ** * * **** *** * *** * * ** * *** * ** is earlier than ** ** *** * * *
* * ****** ** ** * * ** * * ** * *** ** *** if(m2>m1)
*** ** ** * *** ** * ** *** ** *** * * ***** * *** * ** * ** ** * **** ** ** * * is earlier than %d/%d/%d",m1,d1,y1,m2,d2,y2);
* ** **** ** * * * * *** * ** if(m2==m1)
** * ** * * * ** * ****** * ** * *
***** * *** * * ***** ** ** * *** ** * * * *** * * **
* * * * ****** * * ***** * * *** *** * *** * ** * * **** * ** * is earlier than %d/%d/%d",m2,d2,y2,m1,d1,y1);
* * ** *** ***** ** ******** * * * **** ** *** if(d2>d1)
* ** * * * *** *** ** * **** * ****** * ******* ** ** * **** * ** * ***** is earlier than %d/%d/%d",m1,d1,y1,m2,d2,y2);
** *** ** * * ** * ** ** * * * ** *** **
*** ** * ** *

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



int main()

{
* ** ** ** * ** * d1, m1, y1, d2, m2, y2, ** ***


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


* * ****** ** ** ****** = d1 + m1*30 + y1*365;
* * * *** ** * * * *** * = d2 + m2*30 + y2*365;


*** ** * * * * *** * * ** *** * **** ** **
* ** * *** * * ** ** * ** * * * ** * * ** is earlier than * ** *** * d2, m2, y2, d1, m1, y1);
*** ** * ** * ** *****
** ****** ** ** ** * ** * * * * * * * ** * ***** *** * is earlier than ** ** *** d1, m1, y1, d2, m2, y2);


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

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

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
| 3.7k views
0 like 0 dislike
82 answers
[Exercise] Coding (C) - asked Mar 9, 2017 in C by thopd (12.1k points)
ID: 22674 - Available when: Unlimited - Due to: Unlimited
| 5.1k views
0 like 0 dislike
111 answers
asked Mar 16, 2017 in C by thopd (12.1k points) | 7.4k views
12,783 questions
183,442 answers
172,219 comments
4,824 users