Computers and Technology

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; }

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 11:40, silviamgarcia
Pthreads programming: create and terminate a thread write a c++ program that creates a thread. the main will display a message “hello world from the main”. the main will create a thread that will display a message “hello world from the thread” and then terminates with a call to pthread_exit()
Answers: 3
image
Computers and Technology, 23.06.2019 00:30, lm18618
Which one of the following is considered a peripheral? a software b mouse c usb connector d motherboard
Answers: 2
image
Computers and Technology, 23.06.2019 12:00, daelinrobinson
If you're using an existing powerpoint presentation that will receive new slides based on a word outline, select the a. slide that will appear after the new slides. b. first slide in the presentation. c. slide that will appear before the new slides. d. last slide in the presentation.
Answers: 2
image
Computers and Technology, 24.06.2019 03:00, SiegeHatake4534
Will do anything for brainlest so can you guys me out i will try my best to you out
Answers: 1
Do you know the correct answer?
Write a program that asks the user for a date in the format mm/dd/, using a custom struct to store t...

Questions in other subjects: