Converting Time To Decimal using C++
###### Posted by Samath
Last Updated: January 04, 2017

This program will accept a time from the user and convert it to decimal form.

Code:

```#include <iostream>
using namespace std;

int main()
{
int hours = 0;
int minutes = 0;
int seconds = 0;

cout << "Enter number of hours and minutes and seconds (H M S):  ";
cin >> hours >> minutes >> seconds;

cout << "The number of hours is: " << hours << endl;
cout << "The number of minutes is: " << minutes << endl;
cout << "And the number of seconds is: " << seconds << endl;

float decTime = (float)hours + ((float)minutes / 60.0) + ((float)seconds / 3600);
cout << decTime;
return 0;
}```

###### Decimal to Binary in C++
Samath | Dec 26, 2014
###### SQL Display two digits after decimal point
SceDev | Feb 08, 2024
###### How do you check if a string contains only decimal characters in Python?
QuinnLw | Aug 20, 2024
###### Python Convert Decimal to Binary or Binary to Decimal
Samath | Jan 09, 2017
###### Time and Date Changer in C#
Samath | Dec 30, 2016
###### C++ Create Time Delays
Samath | Jan 05, 2017
###### How do you use the TIME data type to store time-only values in SQL Server?
RoseHrs | Jul 23, 2024
###### Convert Roman numerals to decimal using Java
Samath | Jan 17, 2024
###### C++ Convert from Decimal to Octal
Samath | Jan 05, 2017
###### Binary to Decimal Conversion in C#
Samath | Jan 10, 2021
###### C++ program that prompts the user to input a decimal number and outputs the number rounded to the nearest integer
Samath | Apr 06, 2022
###### Write a Python function to convert a decimal number to binary.
CarolTh | Aug 29, 2024
###### How do you convert a binary number to a decimal number in Python?
IreneSm | Aug 31, 2024
###### C++ program that prompts the user to input the elapsed time for an event in seconds then outputs the elapsed time in hours, minutes, and seconds
Samath | Apr 06, 2022