Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

cougarsmustangs

  • 3 years ago

1

  • This Question is Closed
  1. dave0616
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    what are the erros that you are getting?

  2. dave0616
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    Well first off you are going to have to add #include <time.h> at the beginning. i am compiling your code now and fixing it

  3. dave0616
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    *to the best of my abilities

  4. dave0616
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    what are you trying to do with the first part of the code? it seems that you are calling a structure and calling other structures into that structure? i never saw an initial definition of any of the structures, correct me if i am wrong

  5. dave0616
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    #include <stdio.h> #include <time.h> int dt; struct dateAndTime clockKeeper (struct dateAndTime dt) { struct time timeUpdate (struct time now); struct date dateUpdate (struct date today); dt.stime = timeUpdate (dt.stime); if ( dt.stime.hour == 0 && dt.stime.minutes == 0 && dt.stime.seconds == 0 ) { dt.sdate = dateUpdate (dt.sdate); } return dt; } int main (void) { int dt1; int dt2; struct dateAndTime dt1 = { { 12, 31, 2004 }, { 23, 59, 59 } }; struct dateAndTime dt2 = { { 2, 28, 2008 }, { 23, 59, 58 } }; printf ("Current date and time is %.2i/%.2i/%.2i %.2i:%.2i:%.2i\n", dt1.sdate.month, dt1.sdate.day, dt1.sdate.year, dt1.stime.hour, dt1.stime.minutes, dt1.stime.seconds); dt1 = clockKeeper (dt1); printf ("Updated date and time is %.2i/%.2i/%.2i ", "%.2i:%.2i:%.2i\n\n", dt1.sdate.month, dt1.sdate.day, dt1.sdate.year, dt1.stime.hour, dt1.stime.minutes, dt1.stime.seconds); printf ("Current date and time is %.2i/%.2i/%.2i " "%.2i:%.2i:%.2i\n", dt2.sdate.month, dt2.sdate.day, dt2.sdate.year,dt2.stime.hour, dt2.stime.minutes, dt2.stime.seconds); dt2 = clockKeeper (dt2); printf ("Updated date and time is %.2i/%.2i/%.2i " "%.2i:%.2i:%.2i\n\n",dt2.sdate.month, dt2.sdate.day, dt2.sdate.year, dt2.stime.hour, dt2.stime.minutes, dt2.stime.seconds); printf ("Current date and time is %.2i/%.2i/%.2i " "%.2i:%.2i:%.2i\n", dt2.sdate.month, dt2.sdate.day, dt2.sdate.year, dt2.stime.hour, dt2.stime.minutes, dt2.stime.seconds); dt2 = clockKeeper (dt2); printf ("Updated date and time is %.2i/%.2i/%.2i " "%.2i:%.2i:%.2i\n\n", dt2.sdate.month, dt2.sdate.day, dt2.sdate.year, dt2.stime.hour, dt2.stime.minutes, dt2.stime.seconds); return 0; } I made some changes, most of them were missing commas etc, just because I cannot figure out what some of your variables are. If you include more information, such as an assignment rubric or something, I might be able to help more

  6. dave0616
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    i know it is, i only fixed minor errors, but the thing that puzzles me is your initial struct. every time i have used a struct, it is to identify certain parts. like struct zipcode { int label; double lon; double lat; }; so i cant figure out why you are trying to return anything from a stuct

  7. dave0616
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    one thing i can tell you though is that you are going to need another ; at the ending } of your struct

  8. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy