Comprobar HMS
This commit is contained in:
1 parent
d459661d0a
commit
7af7a01592
1 file changed
+4
-1
@@ -11,6 +11,10 @@ void main() {
|
|||||||
h = sc.nextInt();
|
h = sc.nextInt();
|
||||||
m = sc.nextInt();
|
m = sc.nextInt();
|
||||||
s = sc.nextInt();
|
s = sc.nextInt();
|
||||||
|
if (h >= 24 || m >= 60 || s >= 60){
|
||||||
|
System.out.println("Error: Hora inválida");
|
||||||
|
return;
|
||||||
|
}
|
||||||
s++;
|
s++;
|
||||||
// Espagueti máximo xd
|
// Espagueti máximo xd
|
||||||
if(s > 59){
|
if(s > 59){
|
||||||
@@ -20,7 +24,6 @@ void main() {
|
|||||||
m = 0;
|
m = 0;
|
||||||
h++;
|
h++;
|
||||||
if(h > 23){
|
if(h > 23){
|
||||||
m = 0;
|
|
||||||
h = 0;
|
h = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user