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:30
Why is it a good idea to leave an interview being courteous and polite?
Answers: 1
question
Computers and Technology, 21.06.2019 22:00
Problems: 1. using textbooks, reference books, and internet as your source of research, draw the following microprocessor microarchitectures i. intel 8086 ii. motorola 68000 i atmel atmega32 iv. mips single cycle v. arm cortex-m3 write an hdl module for a hexadecimal seven-segment display decoder. the input is 4-bit binary representing a hex number (0-f), and the output is 8-bit seven segment display bits (a-h). thus, the decoder must handle the digits 10 - 15 to display a-f respectively, in addition to 0-9 numbers. 2. design a 4-bit left and right rotator (both outputs). first sketch schematic diagrams of your design. then implement your design using hdl coding. 3. 4. design a modified priority encoder that receives an 8-bit input, a7: 0 and produces a 3-bit output, y2o. y indicates the most significant bit of the input that is true. y should be 0 if none of the inputs are true. give a simplified boolean equation, sketch a schematic, and write an hdl code. 5.write an 8: 1 multiplexer module called mux8 with selection inputs s, data input d, and data output y. data input (d) and data output (v) are 32-bit wide
Answers: 3
question
Computers and Technology, 22.06.2019 17:00
Aisha has finished working on a word processing document that contains 15 pages. she has added some special elements in the first three pages, page 9 and 10, and page 15 from the document. she wants to print only these pages to see how they look. which option is the correct way to represent (in the print dialog box) the pages that aisha wants to print
Answers: 3
question
Computers and Technology, 22.06.2019 18:00
What is the first view you place in your drawing?
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, 04.08.2019 10:10