Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
My Massive Packet
#3
Found it left it in a class.  Anyway here is the fist problem.  Please try to explain how you solved especially if you figure it out and I have not.  This isn't to rip you of code I just haven't touched QB in awhile and need to relearn some things to say the least.

Problem 1: What time is it?

    Military personnel avoid confusion between morning and afternoon times, a.m. and p.m., by using a 24-hour clock rather than a 12-hour clock.  Time is measured sequentially in a 24-hour period and is expressed as a 4 digit number number between 0001 and 2400.  The first two digits represent the number of hours past midnight.  After noon, add 12 to the hour to convert from standard time to military time.  Note that one or more leading digits of 0 are used if the number of hours is less than 10.  The last two digits represent the number of minutes after the top the hour.  Some examples of standard to military time conversions are shown in the table below.

Standard Time                    Military Time     
12:01 a.m.                        0001 hours
9:00 a.m.                          0900 hours
11:30 a.m.                        1130 hours
1:00 p.m.                          1300 hours
5:45 p.m.                          1745 hours
10:59 p.m.                          2259 hours

    Your program will read pairs of times in military format and print the number of hours and minutes elapsed from the first time to the second time.  If the first time is later than the second time, then the second time represents a time from the next day.  The first line of the input file contains the number of pairs of time to be processed.  Each of the remaining lines of the input file contains two military times per line (hours, minutes, hours, minutes).  Your output should indicate the number of hours and number of minutes elapsed between the two times for each pair of times in the input file.

Remember C++, Java, and VisualBasic programs should read from a separate data file

QBasic should read from the DATA statements in the code

Sample Input:

C++/Java                        QBasic                            VisualBasic
2                                    DATA 2                          2
09 00 17 30                      DATA 09, 00, 17, 30          09, 00, 17, 30
18 25 09 00                      DATA 18, 25, 09, 00          18, 25, 09, 00

Sample OutPut: (display this to the screen do not put the output into a file)

8 hours 30 minutes
14 hours 35 minutes
Reply


Messages In This Thread
My Massive Packet - by Tia - 02-27-2008, 06:29 AM
Re: My Massive Packet - by Tia - 02-29-2008, 04:36 AM
Re: My Massive Packet - by Tia - 03-01-2008, 02:19 AM
Re: My Massive Packet - by Ralph - 03-28-2008, 07:59 PM
Re: My Massive Packet - by Moneo - 03-29-2008, 12:05 AM
Re: My Massive Packet - by Ralph - 03-29-2008, 02:42 AM
Re: My Massive Packet - by Moneo - 03-29-2008, 05:54 AM
Re: My Massive Packet - by Ralph - 03-31-2008, 02:32 AM
Re: My Massive Packet - by Moneo - 03-31-2008, 06:59 AM
Re: My Massive Packet - by Ralph - 03-31-2008, 07:47 AM
Re: My Massive Packet - by Tia - 04-02-2008, 06:12 AM
Re: My Massive Packet - by Ralph - 04-02-2008, 06:23 AM
Re: My Massive Packet - by Tia - 04-03-2008, 04:42 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)