All pastes #2107503 Raw Edit

Unnamed

public text v1 · immutable
#2107503 ·published 2012-01-29 18:04 UTC
rendered paste body
//Chris Kellen
//Project 1 - Military Time
#include <iostream>

using namespace std;

int main()
{

    //Initialization of ints
    int time1;
    int time2;
    int curTime;
    //The hours and minutes
    int h1;
    int h2;
    int m1;
    int m2;
cout << "Hour1: ";
cin >> h1;
//cout << endl << "Minute: ";
//cin >> m1;
cout << endl << "Hour2: ";
cin >> h2;
//cout << endl << "Minute: ";
//cin >> m2;

time1 = (h1 / 100) * 60;
time2 = (h2 / 100) * 60;
//time1 = h1 * 60 + m1;
//time2 = h2 * 60 + m2;

curTime = (time2 - time1 + 24 * 60) % (24 * 60);

cout << curTime / 60 << " hours and " << curTime % 60 << " minutes";
    //curTime = ((time2 - time1)/100) - (((time2 - time1)/100)%100);

    return 0;

}