473,406 Members | 2,273 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Guidelines on how to write a C Program that will calculate time in hours and minutes

Hi,

I am Patricia and I would like to get some assistance to write a Program in C.
Your help would be greatly appreciated.

The Program must calculate how long it takes to fly from one place to another if the program is given:
a. starting place
b. departure time in hours and minutes
c. destination
d. arrival time in hours and minutes
e. the time difference in hours between starting place and destination.

Note: Departure and arrival are on the same day.
The answer should be in hours and minutes and only integer arithmetic is allowed.
Jun 12 '07 #1
4 5973
DeMan
1,806 1GB
Hi patsandy,

Welcome to thescripts. I will move this thread to the C Forum, where better qualified experts can have a look at it. You will still be able to access it from this thread, however to post directly to hte c forum in future, select it from the options available from the blue bar near the top of the screen.

I hope the experts in the c/c++ forum can be of help!
Jun 12 '07 #2
Savage
1,764 Expert 1GB
Hi,

I am Patricia and I would like to get some assistance to write a Program in C.
Your help would be greatly appreciated.

The Program must calculate how long it takes to fly from one place to another if the program is given:
a. starting place
b. departure time in hours and minutes
c. destination
d. arrival time in hours and minutes
e. the time difference in hours between starting place and destination.

Note: Departure and arrival are on the same day.
The answer should be in hours and minutes and only integer arithmetic is allowed.
Hi Patricia,
welcome and thank you for joining the scripts.Please ask a specific question so that we can help you and also it's highly recommended that you read pstong guidelines

Savage
Jun 12 '07 #3
Hi Patricia,

Just to give you some initial hints (though you can do it in so many ways!!):

1) Check if both times are in 24 hour clock or not. If yes then its fine, otherwise turn them into 24 hour clock system (you just need to add 12 if the given time is in pm).

2) It will be easier for further calculation if you transfer those times into decimal system. All you need to do is : given hour + (given min/60)

3) Now you are almost done! Just find a way to subtract those times and use time difference in your calculation :D I am sure you can find that out.

Hope it helps

--Sorower
Jun 12 '07 #4
Silent1Mezzo
208 100+
Hi,

I am Patricia and I would like to get some assistance to write a Program in C.
Your help would be greatly appreciated.

The Program must calculate how long it takes to fly from one place to another if the program is given:
a. starting place
b. departure time in hours and minutes
c. destination
d. arrival time in hours and minutes
e. the time difference in hours between starting place and destination.

Note: Departure and arrival are on the same day.
The answer should be in hours and minutes and only integer arithmetic is allowed.
1. Convert b, d into the same measurement of time (if they're different, ie one 12hr one 24hr)
2. Subtract b from d
3. Add e to the answer from 2.

PS. Didn't read through the post above :P Sorry for basically the same answer
Jun 12 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

28
by: Steve | last post by:
Hi all How would I find out the average date when given a bunch of dates? For example, I want to find the average length in time from the following dates:...
5
by: cvisal | last post by:
Hi all Im working on productivity calculations (Time calculations) and need some help in coding. Database Tool:MS-Access 2003. The general operator punch-in time is 5:30 AM and the punch-out...
6
by: cj | last post by:
I want to make a class that will write data to a in memory table. This class will be called by multiple threads. I'm hoping the table can stay in memory between calls and all the call by the...
5
by: RyMonster23 | last post by:
I have to use a do-while loop to force the user to enter a value within the listed range. Also, if the user does enter a value outside the range, use an "if" conditional to display a message...
5
by: jbailey006 | last post by:
I am trying to add the following information to a payroll program I am working on for assignment. Modify the Payroll Program so that it uses a class to store and retrieve the employee's name, the...
7
by: walt | last post by:
Hello, I have been trying to calculate the difference between two date and display the difference in hours and minutes (HH:MM). I can't get it calculate properly and I can't hours and minutes to...
9
by: brendanmcdonagh | last post by:
Hi, I am designing a project for my friend as I am just a week old baby to vb and want to implement what I've learnt so far. She wants to be able to put start time, end time and lunch for each...
2
by: hamady2001 | last post by:
Hello everyone this is my first post and I just started my Python class. I am stuck on an assignment...please help I have to redo the below program (from a prior assignment) to include 2 functions...
1
by: ylekot88 | last post by:
Hello. Yes, I am a newbie to Javascripting for a whole 3 weeks now. I have been given an assignment in a book that is horribly worded, and I have spent about 30 hours trying to figure out what I am...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.