1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
OLEGan [10]
3 years ago
7

g c 24-hour time (also known in the U.S. as military time) is widely used around the world. Time is expressed as hours since mid

night. The day starts at 00:00, and ends at 23:59. Write a program that converts am/pm time to 24-hour time. The input is two numbers and a string. If the input is 2 30 pm, the output should be 14:30. If the input is 12 01 am, the output should be 00:01. Hints: Think of how each hour should be handled. 12 00 am -12 59 am becomes what
Computers and Technology
1 answer:
SpyIntel [72]3 years ago
5 0

Answer:

see explaination

Explanation:

#include<string>

using namespace std;

int main(){

int hr, min; string meridian;

int m_hr, m_min;

do{

cout<<"Enter hour [0-12]: "; cin >> hr;

}while(hr<1 || hr>12);

do{

cout<<"Enter minutes [0-59]: "; cin >> min;

}while(min<0 || min>59);

do{

cout<<"Enter am or pm: "; cin >> meridian;

}while(meridian.compare("am")!=0 && meridian.compare("pm")!=0);

int abs_time = 0;

if(meridian.compare("am")==0){

abs_time = hr*60 + min;

if(hr==12){

abs_time -= hr*60;

}

}else{

abs_time = 12*60 + hr*60 + min;

}

m_hr = abs_time/60;

m_min = abs_time%60;

cout<<"Military Time: "<<(m_hr<10?"0":"")<<m_hr<<":"

<<(m_min<10?"0":"")<<m_min<<endl ;

}

You might be interested in
You are the owner of a computer component manufacturing company. Your manufacturing plant has 10 different machines that can be
Murljashka [212]

Answer:

7 raise to power 10

Explanation:

Since there are 4 possible ways to make memory chip and 3 possible ways to manufacture mother board, so for each machines we have 7 possible ways of configurations.

So total number of ways in which these machines can be configured is 7*7*7*...*7= 7raise to power 10 possible ways

7 0
3 years ago
Consider the following code snippet:public static void main(String[] args) throws FileNotFoundExceptionWhich of the following st
iVinArrow [24]

Answer:

The main method should simply terminate if the FileNotFoundException occurs.

Explanation:

Considering the full code snippet

snippet:public static void main(String[] args) throws FileNotFoundException

public static void main(String[])

represent the entry point method to a java main method

The addition of

throws FileNotFoundException

widens the scope of the main method to explicitly specifies that an exception named the FileNotFoundException may be thrown.

So, if any part of the code explicitly throws the FileNotFoundException the compiler makes use of this to throw an exception.

By throwing an exception, the main method is not catching any exceptions, instead it handles the FileNotFoundException by throwing it to the source which invoked the main method

This is required by the compiler to terminate the program if the FileNotFoundException occurs.

8 0
3 years ago
Is the disk in the C: drive fixable or removable disk
katrin2010 [14]

Answer:

The disk is a removable disk.

8 0
3 years ago
Read 2 more answers
SHOW ME SOME C++ TUTORIALS?
german
Google c++ tutorial. Cplusplus and Tutorials Point both have some good resources
4 0
4 years ago
As an interviewer, it is not necessary to be at eye level with interviewee<br><br> True<br> False
Tamiku [17]

Answer:

True

Explanation:

Have a great day

3 0
3 years ago
Read 2 more answers
Other questions:
  • Design and document an IP addressing scheme to meet ElectroMyCycle’s needs. Specify which IP address blocks will be assigned to
    11·1 answer
  • If you delete a file from removable media, it is stored in the recycle bin where you can recover it until you empty the recycle
    13·1 answer
  • How can you have a safe browser experience
    9·1 answer
  • There will be 10 numbers stored contiguously in the computer at location x 7000 . Write a complete LC-3 program, starting at loc
    14·2 answers
  • What is the major benefit Smartphones and tablet computers have had on social media?
    9·1 answer
  • To answer the research question "How am I going to find the information I need on the tople?" the best thing Georgia should
    15·1 answer
  • Determine what is printed by the following code.
    8·1 answer
  • Who are all the fnaf characters?
    7·1 answer
  • Write code to define a function named mymath. The function has three arguments in the following order: Boolean, Integer, and Int
    11·1 answer
  • What special enterprise VPN supported by Cisco devices creates VPN tunnels between branch locations as needed rather than requir
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!