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

Expert's answer

#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");

}
LATEST TUTORIALS
APPROVED BY CLIENTS