Problem: Calculate The Time In Seconds Since The Last Time Clock Struck 12?

in #programming6 years ago

Soluction:

#include< iostream>
using namespace std;

     double seconds_count(int hours, int minutes, int seconds){
        double seconds_calculation;
 if(hours<=12){
    seconds_calculation=hours*3600;
    seconds_calculation=seconds_calculation+minutes*60;
    seconds_calculation=seconds_calculation+seconds;
    
    return seconds_calculation;
}
else
    return -1;

 }
int main()
  {
int a, b,c, output;
cout<<"Enter Hours :";
cin>>a;
cout<<"Enter Minutes :";
cin>>b;
cout<<"Enter Seconds :";
cin>>c;
output=seconds_count(a,b,c);
if (seconds_count(a,b,c)>-1){
cout<<"Seconds That Has Passed Since The Last Time Clock Struck 12:"<<output;
    }
else
cout<<"Sorry You are Exeeding The Time Limit";
 }

Sort:  

Congratulations! This post has been upvoted from the communal account, @minnowsupport, by mohsan from the Minnow Support Project. It's a witness project run by aggroed, ausbitbank, teamsteem, theprophet0, someguy123, neoxian, followbtcnews/crimsonclad, and netuoso. The goal is to help Steemit grow by supporting Minnows and creating a social network. Please find us in the Peace, Abundance, and Liberty Network (PALnet) Discord Channel. It's a completely public and open space to all members of the Steemit community who voluntarily choose to be there.

Coin Marketplace

STEEM 0.29
TRX 0.11
JST 0.033
BTC 63945.57
ETH 3135.76
USDT 1.00
SBD 4.00