C Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesC Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 9th, 2012, 11:29 AM
C505 C505 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 23 C505 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 12 h 34 m 7 sec
Reputation Power: 0
Help Please: Elapsed Time Function

/* 3. Write a function elapsed_time that takes as its arguments two time structures and returns a time structure that represents the elapsed time (in hours, minutes, and seconds) between the two times. So the call elapsed_time (time1, time2) where time1 represents 3:45:15 and time2 represents 9:44:03, should return a time structure that represents 5 hours, 58 minutes, and 48 seconds. Be careful with times that cross midnight. */

This is what I have so far, Im confused on where to put the function, how to return the times, and in general how I should proceed on this. Any help is appreciated.

Code:
#include <stdio.h> 
#include <stdbool.h> 
#inlcude <conio.h> 
struct time // define structure 
{ int hour; int minute; int second; } 

void elapsed_time(struct time1, struct time2, struct elapsed); // arguments are 2 time structures 
int main(void) 
{ struct time time1, time2; printf ("Enter starting time (HH MM SS): "); 
scanf ("%i%i%i". &time.hour, &time.minute, &time.second); getchar();

Reply With Quote
  #2  
Old November 9th, 2012, 01:17 PM
b49P23TIvg's Avatar
b49P23TIvg b49P23TIvg is offline
Contributing User
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Aug 2011
Posts: 3,368 b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 3 Days 11 h 16 m 11 sec
Reputation Power: 383
I think the question is about this.
__________________
[code]Code tags[/code] are essential for python code!

Reply With Quote
  #3  
Old November 10th, 2012, 12:36 PM
C505 C505 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 23 C505 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 12 h 34 m 7 sec
Reputation Power: 0
Quote:
Originally Posted by b49P23TIvg
I think the question is about this.


Thanks for the reply, we weren't allowed to use the time header file. I eventually got something to work. Thanks.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesC Programming > Help Please: Elapsed Time Function

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap