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, 21.06.2019 19:40
Microsoft introduced active directory with windows 2000. in server 2012, it is in now version 4. what are some new features in the new ad that were not present in windows 2000 ad?
Answers: 1
question
Computers and Technology, 22.06.2019 15:10
David is in week 3 of his current ashford course and has a paper due by monday night at midnight. he has finished everything but the concluding paragraph. as he boots up his computer to work on it, he sees a flash across the screen and then the screen goes black. he begins to panic as he tries desperately to turn the laptop back on. david should have saved his work on what kind of portable device?
Answers: 2
question
Computers and Technology, 22.06.2019 20:10
Assume the existence of a bankaccount class. define a derived class, savingsaccount that contains two instance variables: the first a double, named interestrate, and the second an integer named interesttype. the value of the interesttype variable can be 1 for simple interest and 2 for compound interest. there is also a constructor that accepts two parameters: a double that is used to initialize the interestrate variable, and a string that you may assume will contain either "simple", or "compound", and which should be used to initialize the interesttype variable appropriately. there should also be a pair of functions getinterestrate and getinteresttype that return the values of the corresponding data members (as double and int respectively).
Answers: 2
question
Computers and Technology, 23.06.2019 09:30
The place where the extended axis of the earth would touch the celestial sphere is called the celestial
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
Biology, 10.12.2019 18:31
question
English, 10.12.2019 18:31
Questions on the website: 13722361