FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
cpp-programming/OOP1-Lab5/Source2.cpp at main · whshi574/cpp-programming · GitHub
whshi574
/
cpp-programming
Public
forked from
Rustam-Z/cpp-programming
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
cpp-programming
/
OOP1-Lab5
/
Source2.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
50 lines (38 loc) · 1.17 KB
Breadcrumbs
cpp-programming
/
OOP1-Lab5
/
Source2.cpp
Copy path
File metadata and controls
50 lines (38 loc) · 1.17 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//
Practical Lab Assignment-7(Week 9)
//
ID:U1910049 Name: Rustam Zokirov
//
Program to convert into minutes
#
include
<
iostream
>
using
namespace
std
;
bool
GetMinutesFromTime
(
double
hours,
double
minutes,
double
seconds) {
if
(hours <
0
) {
cout <<
"
Your hours input is wrong
"
<< endl;
return
false
;
}
if
(minutes <
0
) {
cout <<
"
Your minutes input is wrong
"
<< endl;
return
false
;
}
if
(seconds <
0
) {
cout <<
"
Your seconds input is wrong
"
<< endl;
return
false
;
}
double
ResultMinute = minutes + (hours*
60
) + (seconds/
60
);
cout <<
"
The result minute is
"
<< ResultMinute<<endl;
return
true
;
}
int
main
()
{
double
InputHours, InputMinutes, InputSeconds;
bool
bIsGetSuccess =
0
;
do
{
if
(!(cin >> InputHours >> InputMinutes >> InputSeconds)) {
//
Input error occurred
cin.
clear
();
//
Clear the error state
cin.
ignore
(std::numeric_limits<std::streamsize>::
max
(),
'
\n
'
);
//
Clear the input buffer
cout <<
"
Please enter again , you enter the wrong value
"
<< endl;
continue
;
}
bIsGetSuccess =
GetMinutesFromTime
(InputHours, InputMinutes, InputSeconds);
}
while
(!bIsGetSuccess);
return
0
;
//
indicates that the program will ended successfully
}
Back
|
FazBrowse Home
|
New Git URL