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, 23.06.2019 04:00
Another name for addicting games.com
Answers: 1
question
Computers and Technology, 24.06.2019 01:00
The initial tableau of a linear programming problem is given. use the simplex method to solve it. x 1 x 2 x 3 s 1 s 2 z 1 2 4 1 0 0 8 3 4 1 0 1 0 10 minus3 minus12 1 0 0 1 0 the maximum is nothing when x 1equals nothing, x 2equals nothing, x 3equals nothing, s 1equals3, and s 2equals0. (be sure to simplify to lowest terms if necessary.)
Answers: 2
question
Computers and Technology, 24.06.2019 12:00
What is a sketch or blueprint of a web page that shows the structure (but not the detailed design) of basic page elements such as the logo, navigation, content, and footer?
Answers: 3
question
Computers and Technology, 24.06.2019 16:50
Ramp charts are generally created in wordlotusexcelpowerpoint
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, 03.05.2020 13:38
question
Mathematics, 03.05.2020 13:38
Questions on the website: 13722363