0 like 0 dislike
7.8k views

Write a program that accepts a date from the user in the form: month dd, yyyy and then display it in the form of mm/dd/yyyy , where month is the name of the month.

Example input:

February 17, 2011

Example output:

You entered the date 2/17/2011
[Exercise] Coding (C) - asked in C
ID: 22973 - Available when: Unlimited - Due to: Unlimited
| 7.8k views
0 0
Called for Help

50 Answers

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

#include *** ** ***



int main()

{
*** * * ** *** ** ** *** *** *** *** * *** * * *** **** ** * * **** * * * ** ** *** * * * ** * * *** * ** **** * * ** * ** *** * * * * * ** * * ** * **** * ** *** * * **** * * ** ** m[10];
* ****** ** ** ** * * * * d, y, i;
* * * **** * ** * * * * *** * %d, %d", m, &d, &y);
* * * *** *** ** ** * ** * i<12; i++)
** ** ** *** * * * ** * * * * * ** ** * * * * * a[i]) == 0){
** ** * * * * * * * ** * * ******** ** *** * * * ******** ** * * * *** ** entered the date %d/%d/%d", i+1, d, y);
* *** * * ** *** ** ** * * *** * **** ** * ****** * ** * *


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

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

#include <stdlib.h>

#include <string.h>



int main(){
* ** * ** ** ** * * * * * year = 0;
*** ** *** * * ** atr [9],btr *** * ** * **** * * * * *
** ** * * * * * * * **** ** a[10] ="January",b[10] = "February",c[10] = * ** * *** ***** * * ** *** ******* * * *** * * * ** ******* ** * * ******** ** * ** * * * **** * * ** * **** * * * * ** * ** * * *** ** * ***** * * ** * * **
** *** * * * * * ** ** * * * *** * *
*** * * * **** * ** * *** ******
* ** ** ** *** ** * * * ** **** ** **** * * * **
* * ** * * * * * ****** if (strcmp(atr,b)==0){
** * * ** ** * * *** **** ** ** * **** *** ***
* * ** * * * *** **** if (strcmp(atr,c)==0){
**** * * ***** ***** * * * ***** * * * *** * ** * **
** * *** * * *** ** * * if (strcmp(atr,d)==0){
* * * ** * ** *** *** ** * ** * * * * **** *** * ** *
* ** * * *** ** * ** if (strcmp(atr,e)==0){
** * ** * ** *** * * ** ***** * ** * * * *** * * ***
* * * * * ******** * * if (strcmp(atr,f)==0){
* * * ** * ** ** * * **** *** ******* * *** ** ** * ***
** ** *** ** ************ ** * if (strcmp(atr,g)==0){
* ** *** ** * * ** ** *** ** ** **** *** * *** * * *
** *** * ** ** *** * if (strcmp(atr,h)==0){
** * ** **** ******* *** ** * * ** * * * * * * *   
* * ***** ** ** ** * * * if (strcmp(atr,i)==0){
** **** * * *** *** * ** * * ** ** * ** *   
**** **** * * * ** ** * if (strcmp(atr,j)==0){
* * * * *** * *** ** ** *** * *** * * **** * ** * **  
* ** ****** * ** * if (strcmp(atr,k)==0){
** *** * ** ** * * ********* * * * ** *** ** * * * **
** ** ** ** * ** ** *** * if (strcmp(atr,l)==0){
* ** * ** ** * * *** * * * ** **** ** * * *** **** ** *** ** **** * * * * * *
* **** * *** ** ** ** **** * entered the date * * * * ** ** ** **** * * *

    
** ** * * ***** * * **
* ** **** ** * *** ** *
* * **** * ** * * * 0 ;
* * ***** * * * * ** *
answered by (-136 points)
0 like 0 dislike
Hidden content!
#include * ** ** * *

#include * *** * ***



int main()

{

char *** * * *** ** *** * * * *** * * ** *
*** * * ** * * * * ** **** * * ** ** * * * ** * * ****** ** * ** * ** * * ** * **** * * * ******** * * * ** ** *** * *
* ****** * ** * ********** ***** ** ** ** * * * ** *** ** * * * * * * * * ** * *** * * *** *** * * * ***
** * ** * * * * * ** *** * * * **** * * * **** **** * ***** ** ** * * * * * **** ** * * ** * ** * * * * *** ** * * ** * * **** ***





char m[20];

int day;

int year;

int flag;

int i;


* * * ****** %d, *** ** ** **** ,&day * * *



for (i = 0; i <12; i++){

    **** ** * * *** ** * * , m ) ==0 )
* **** * * * * ** * ** ** ** ** * * **

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

}

printf ("You entered the date * ** ** *** *



return 0;

}
answered by (-34 points)
0 like 0 dislike
Hidden content!
#include *** *** * **

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



int main()

{

char * * ** * *** * ** * * **** ** * * ***** * *
** **** * *** **** *** * ******* * ** *** *** *** **** ** ** ***** * * * * * * *** * *** * *** * * * * *** * * * * ***
** ** ** *** ******** ** * * *** ** *** * * ** * * * * *** * * ** ** * ** * * ** * ** * * **** * **** ****** * ** ** ** ** **
** * * ** * ** * * * ** * *** * ** * *** ** * *** * *** *** ** ***** ** *** **** ** * * *** * * **** * ** * ** * * ** ***





char *m[20];

int day;

int year;

int flag;

int i;



scanf("%s %d, **** ** * ,&day ,&year);



for (i = 0; i <12; i++){
* * *** * * * **** ***** *** * **** (strcmp(months[i] , m ) ==0 )
** ** ***** * * ** * ** * * ** * * ***
* * **** **** ** * ** *** **** ** **** * * * * ** **
** * * ** * **** ******** * *** *** * * *** ** * *

}

printf ("You entered the date * * * * ** * ** ****



return 0;

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



int main(void)

{
** ** ** ***** * char *a[12];
** * * ** ** * * * * *** * * = "January";
* ** * **** * * * ** * = **** * **** *** * *
* * * * * * *** ** * * = "March";
* * * ** ** * **** ** * = "April";
* * **** * ** = "May";
* * ******* ******* = "June";
* ** * * * * *** * ** * * = "July";
* ** ** ** ***** * = "August";
** ** * * * * * * = ** * * * **** *
** * * * * * * ***** * = "October";
**** *** * ** ****** ** *** = ** ******** *
* * ** * ** * ** = ** * ** ** *


* ****** ** ** * * ** ***** * * *****
* ** *** ** *** **** * date,year,num=0,i;
* * * ** * ** * * * * * * ** ** * %d, * ********** **** * *** **
* ** ** * * * **** ** ** *** ** **
** ****** * ** *
* * * ** * ***** * * ***** ** *** * * ** ** * ** * **
* * * ****** * *** * * ** ** ***** ****** *** * * * *** * *** * **
* *** ** ****** * **** *
*** * *** * * ** * * * ** * entered the date ** *** ** * *





}
answered by (-412 points)
0 like 0 dislike
Hidden content!
#include * ****
*** * * * ** *



int main()

{
* ***** * *** * *
** * * ***** * * ** * * day, year;


** **** **** * ** * ***** * %d, ** ** month_c, * ** ** ** ****


* * ** *** * **** * * == 'J' *** * **** *** == 'u')
* * *** ** * *** ** *** *** * * ****** * * * * * entered the date * * ** * 1, day, year);
** * * **** * **** ** == 'F')
**** ** * * * ** ****** * **** * * * * * * *** entered the date **** * ** * 2, day, year);
* **** *** * **** * * **** * *** * == 'M' * * * ** ** * * * * ** *
****** * ****** ******* * * *** * * * ** * * ** ** entered the date * ** * * 3, day, year);
* * ** * * * ** * * * * * * == 'A' *** ** ** * * *** == 'p')
* *** **** * * *** * * * * * * **** * ** ** * entered the date * ** *** ** 4, day, year);
*** * ** ** * ** * ** == 'M')
* * * ****** **** * ** ** ** * * * **** ** ** *** entered the date **** ** * 5, day, year);
**** **** * * * *** ** * * * * == 'J' *** **** * *** == 'n' * *** ** * * * == 'e')
** *** * * ** *** ** *** * *** ** *** * entered the date * ** * ** ** 6, day, year);
* ** *** * ** * ** * **** ** * ** == 'J' ** * ** * * ** == 'l')
* * ** * *** **** ** * **** ** ** ** * * * * ** *** entered the date ** * * 7, day, year);
** * *** ** *** ** ** ** * ** == 'A')
* * * * ** ****** **** * ** * ** * * * ** * **** entered the date * * * 8, day, year);
* * * **** ** * *** * ** * * == 'S')
* **** ***** *** ** ** * * * ** ** * * ** * ** ** * entered the date *** * ** 9, day, year);
* ** *** *** *** * *** ** * ** == 'O')
*** ** * *** * *** * * ***** * * * * *** * *** * * entered the date * *** * * 10, day, year);
* ** ** * ** * * ** * * ** *** * == 'N')
* * ** ** * * * * ** *** * ** * ** ** * * * * * * * entered the date **** ** 11, day, year);
* ** * * * ****** ** * * == 'D')
* * * * ** * * * * * *** **** ***** * ** ** ********* * entered the date * * * 12, day, year);


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

}
answered by (5.2k points)
0 like 0 dislike
Hidden content!
#include * ** *** **
**** * **** ** *



int main()

{
* * ** * *** ** * * ** ** *** **
** * **** * * ** ****** * ** day, year;


* ** * * ** * *** * ** ***** %d, *** month_c, *** * * * *


** * * * * * ** ** *** * * == 'J')
** * * * * * ** * ** * ** * * * * * * * *** * * entered the date * *** * * 1, day, year);
* ** * * ** *** * ** *** ***** * == 'F')
**** ** ****** *** *** * * *** * * * * entered the date ** * ** * 2, day, year);
** ** ** * * * *** == 'M' ** ** * * * * *
* ** * *** * ** * **** ** ****** **** * ** ** * * entered the date * ** *** * * * 3, day, year);
**** ** ** ** * * * * * ** *** == 'A' ***** **** * * == 'p')
** **** ****** * * ***** * ** ****** ** * entered the date *** * * * ** 4, day, year);
* * ** ** * * * * *** * ** ** * * * == 'M')
*** *** * ** ** *** * * * * *** ** ******* * * ** entered the date * * **** * * 5, day, year);
* *** * ** ** * ** ** * ** * ** == 'J' * ** * ** * **** == 'n' ** ** **** ** == 'e')
*** ** * * * ** ** * ** ** ** * ** ** * ** ** entered the date * *** *** 6, day, year);
*** * * ** ** * * ** *** * * * == 'J' * *** ** * == 'l')
** * ***** * * **** * * * ** * * ** * ** * ** * ***** * entered the date ** * * 7, day, year);
** * * * * ***** ** * == 'A')
**** ** ***** ** * * **** ** ***** * *** * ** **** * entered the date *** * * * 8, day, year);
***** ** * *** * * ** * ** * == 'S')
* * *** * *** * * **** * ** * ** * * *** ** * ** entered the date **** ** * 9, day, year);
* ** * * * * ***** * * == 'O')
** *** ** *** ** ** **** * * **** ** * * ** * entered the date * * * ** * 10, day, year);
* **** * * * *** **** ** * * == 'N')
* ** * * * *** **** * ** * *** *** * * entered the date * ** ** 11, day, year);
**** ** * **** * * ** * *** * == 'D')
* * * ** ****** * * * * * * ** * ** **** ** * entered the date * ** * ** 12, day, year);


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

}
answered by (5.2k points)
0 like 0 dislike
Hidden content!
#include *** * *** ** * *

#include * * ** * * **



int main()

{
* * * ***** * *** * ** * * **
* ** * *** ** * * ** * ** * ***** day, year;


** * * ***** **** * ********* %d, * * month_c, * * * * * *****


* * * ***** ******* ** *** * * == 'J')
** ******* ** * * * * * *** ** *** * * *** ** * entered the date ** *** ** * 1, day, year);
* *** ** * ** ** * **** * == 'F')
* * **** * ** ** * * * * ** ** *** * * *** ****** ** entered the date * * 2, day, year);
* ** * * * * ****** ** == 'M' ******* ** * * * * *
** ** *** * * * ** * ** * * * * * ******* ** * * * * * ** entered the date ** * * 3, day, year);
**** * * ** ** *** *** *** ** ** == 'A' ** * * ** == 'p')
** ** *** * * ***** ****** ** ** ** * * * * * * **** * entered the date * * *** * * * 4, day, year);
** ** *** ** * ***** ** ***** ** == 'M')
* ** * * * ** * * * * **** * * *** ** *** * ** * * * * entered the date ***** * 5, day, year);
* * * **** ***** * ** ** * * == 'J' ** * *** *** == 'n')
** * * * * ** * * ** * * * **** * * ** * * ** ** * ** entered the date **** ****** 6, day, year);
** * * * * ** **** *** * ** == 'J')
* * ** * * **** **** ** * * ** * * * * ** ** ** entered the date * * ***** ** * 7, day, year);
*** ***** *** **** * * *** *** == 'A')
* ** * * ** ** *** * * ** ** * * ****** ** * ** *** entered the date * ******* * 8, day, year);
* * ** ** ** * *** ** * * * * * == 'S')
** * **** * * ** **** * * * * ** **** *** * ** * * entered the date * * * * * 9, day, year);
* *** *** *** **** * ** * == 'O')
**** * * * * * * *** **** * *** * * ** * ** * * entered the date ** * ****** 10, day, year);
* ** * * ** * ** * * * ***** * == 'N')
* * *** *** *** **** ********* * * * *** **** * * * * entered the date ** ** * 11, day, year);
** ** * * * ** * * ** * * == 'D')
* * * **** **** * *** ** ** * * * *** * * * ***** entered the date * ** * 12, day, year);


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

}
answered by (5.2k points)
0 like 0 dislike
Hidden content!
#include **** *

#include * *** * **



int main()

{
*** ********** * ***** * **** *
* * * *** * * **** * * ** * *** ** day, year;


** * ** * *** ** * **** ** * %d, * *** ** month_c, * ** *** * * * ***** *


* *** ***** ** * * ** ** * * == 'J')
*** * ** ** *** ***** ** *** ** * * * * * ** * ** *** * entered the date *** 2, day, year);
** * ** *** * ** ** ** *** ** **** * * == 'F')
** ** * ** ** * * * * ** * *** * *** * * *** *** ** **** ** * entered the date ***** * * ** 2, day, year);
* *** * ** * * ** * ** *** * ** * * == 'M' * * ** ** *
** ** * * * * * *** * * ********* ** **** * * **** ** entered the date ** ** * 3, day, year);
* ** ** * ** ***** *** *** == 'A' *** **** * ** * == 'p')
* **** * ** ** * ****** *** * ** **** * ** * * ** * * * *** entered the date * ******* 4, day, year);
***** *** ** ** ***** * * ** == 'M')
** ** ** **** **** ** ** * *** ********* **** ** ** * entered the date * *** * * 5, day, year);
* * * ** * ** * ***** *** * * == 'J' ** ** * ** * * ***** == 'n')
** * * * * ** ** * *** ** * * *** ** * ** * * ** ***** entered the date * * ** 6, day, year);
* * ** ** * **** ** ** * * == 'J')
** * * **** * **** * ** *** ** ** * * * **** * entered the date * * * * 7, day, year);
** ** * * * ****** * *** *** == 'A')
* ** **** *** ** * *** * * * * * ** ** ******* * ***** * entered the date * * * * * * 8, day, year);
* *** ** ** **** ** ** ** * * * ** * == 'S')
* * ** **** * * **** * * *** ** * * * **** *** ** entered the date *** * * 9, day, year);
* **** ** **** ** ** * == 'O')
* * * * ** *** * * * * ** ** **** ** ***** * ***** entered the date * * ** 10, day, year);
* * * *** *** ** ** *** ** *** == 'N')
** * ** *** **** ** *** * ***** *** * * * ** *** ** * entered the date *** *** *** 11, day, year);
**** * ********** *** * ** * == 'D')
** * ** * ** * * * ** *** * *** * ** ** *** * ** * entered the date * * ** 12, day, year);


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

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

#include<stdlib.h>

#include<string.h>

int main()

{

    char month[8];

    int ** ** ** * * * * * * * ** *
* * ** ***** * ** *** * * **** * * ***** * *
** * * ******* ** * ***** *** * %d",&day,&year);
* ** * * *** *** *** *** * * %d\n %d\n",month,day,year);
* * *** * **** ** * * * *** ** * * * **** *
***** * * *** * * ****** *** *** ** ** ***
* * * ** ** **** *** * * *** * *****
***** * * * ** ** ** **** ** ** ****
* **** *** * * *** **** * * ** * *** * * *
* *** ** * * **** * * * * * **** * * ** ** *
********* ** **** * ** * ** * * ** **
* * ****** ** *** *** ***** **** **** *
* * ** ****** * * *** ** ** * * * ** *
** ********** *** * * **** * *** * * * * **
* ** * *** * ** * * * * * * ** * *
* * *** ** * * * ** *** *** *** *** * * * **

    if(a==0)
*** * * * ** * *** ** * ** * * * * ** * *** * *
* * **** * *** * * ** *
* * * ** * * ** ** * * ***** *** * *** **

    if(c==0)
* * *** ***** * ***** * ** * ** ** * * **

    if(d==0)
* * * **** * * * **** ** ** * ** ** *
* * ** * * * * *** * ** ***
** * * * ** * **** ***** * ** *** * ** ***** * *
** * ** * *** *** **** *
** * * *** * * * ** * * *** * * * * * * *** * *
** ** ** * * * ***** **
** * ** * * *** * **** * * ** ** * **** ** * **
** ** *** *** ** ** ** ** * *
* * ** * ** * **** * * * ** * *** * * ** ***
* **** * ** *** *** * * ***
* * * * * ** ** ** * ***** * **** * ** **** *
** * ***** * * ** ** * *** **
* * *** ** ** * *** * *****

    if(k==0)
* *** * * * * * * * * *** ** * ** ** * * **

    if(l==0)
* ** ** ** ** ** *** ** ****** * *** * * ******
* * *** ** * ** * ** * * * entered the date %d/%d/%d",month1,day,year);

    return 0;

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

Related questions

0 like 0 dislike
56 answers
[Exercise] Coding (C) - asked Mar 9, 2017 in C
ID: 22673 - Available when: Unlimited - Due to: Unlimited
| 8.6k views
0 like 0 dislike
90 answers
[Exercise] Coding (C) - asked Mar 16, 2017 in C
ID: 22972 - Available when: Unlimited - Due to: Unlimited
| 14.1k views
0 like 0 dislike
111 answers
asked Mar 16, 2017 in C by thopd (12.1k points) | 16.7k views
12,783 questions
183,442 answers
172,219 comments
4,824 users