Answer to Question #22267 in C++ for patrick

Question #22267
i need a c++ program that lets you input a time and outputs the different time from the different time zones, UTC -12 up to UTC +12
1
Expert's answer
2013-01-23T08:54:47-0500
#include <iostream>
using namespace std;

int i, h, m;

void main(){

cout<<"enter the hours: ";
cin>>h;
cout<<"enter the minutes: ";
cin>>m;

for (i = -12; i< 13; i++)
cout<<"UTC "<<i<<": "<<(h+i)%24<<":"<<m<<"\n";

system("pause");

}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS