subject

Write a program that asks the user for a date in the format mm/dd/, using a custom struct to store the date information entered in memory. the program should call a custom function that adds seven days to the user's date, passing in the data in and out of the custom function using the custom struct for the dates. the program should then print out the original date entered and the date one week late. anyway, here is the code, check: #include struct date//structure declaration{int day, month, year; //date, month, year; }; void addseven(struct date d)//function which adds 7 to present date and prints to stdout{int m[] ={31,28,31,30,31,30,31,31,30,31,30, 31}; //array to keep track of days in monthd. day = d. day+7; //incrementing daysif(d. day> m[d. month-1])//if exceeds monthly days limit then{int k=d. day-m[d. month-1]; d. day = k; d. month = d. month+1; //increment month countif(d. month> 12)//if month exceeded 12{d. year =d. year+1; //incrementing yeard. month=1; }}//printing resultprintf("date after one week : %d/%d/%d\n",d. month, d.day, d.year); }int main(){struct date present; //present datechar c[10]; printf("enter date in format(mm/dd/) : "); scanf("%s",c); //reading as stringint i=0,k=0,l, s=0; for(i=0; c[i]! ='\0'; i++)//converting to and storing in structure{if(c[i]=='/' & & k==0){k=1; present. month = s; //storing months=0; }else if (c[i]=='/' & & k==1){k=2; present. day = s; //storing days=0; }else {l = (int)c[i]-48; s =s*10+l; }}present. year =s; //storing year//printing present dateprintf("present date : %d/%d/%d\n",present. month, present. day, present. year); addseven(present); //function callingreturn 0; }

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 03:30
Jessie has received a contract to build a real-time application for a baker. however, the baker doesn't want to invest too much money. his only requirement is that he wants the customers to know which cupcakes are available at what time and in what quantity. so his core requirement is that the details of product should be in real time. what platform can jessie use to develop this application?
Answers: 1
question
Computers and Technology, 22.06.2019 10:30
Choose the best explanation for the following statement communication is symbolic
Answers: 3
question
Computers and Technology, 23.06.2019 06:20
Which text function capitalizes the first letter in a string of text? question 10 options: upper capital first proper
Answers: 1
question
Computers and Technology, 23.06.2019 09:30
Light travels at a speed of 186,000 miles a second. the distance light travels in a year is 5,865,690,000,000 miles/year 5,865,695,000,000 miles/year 58,656,950,000,000 miles/year 6,789,000,0000 miles/year
Answers: 1
You know the right answer?
Write a program that asks the user for a date in the format mm/dd/, using a custom struct to store t...
Questions
question
Mathematics, 02.09.2019 02:50
Questions on the website: 13722362