Docsity
Docsity

Prepara tus exámenes
Prepara tus exámenes

Prepara tus exámenes y mejora tus resultados gracias a la gran cantidad de recursos disponibles en Docsity


Consigue puntos base para descargar
Consigue puntos base para descargar

Gana puntos ayudando a otros estudiantes o consíguelos activando un Plan Premium


Orientación Universidad
Orientación Universidad

El derecho fundamental, Esquemas y mapas conceptuales de Derecho Privado

El derecho es fundamental para las personas

Tipo: Esquemas y mapas conceptuales

2023/2024

Subido el 05/09/2024

Anderso190
Anderso190 🇧🇴

2 documentos

1 / 4

Toggle sidebar

Esta página no es visible en la vista previa

¡No te pierdas las partes importantes!

bg1
Contents
1 Introduction 2
2 Definicion clase reloj 2
2.1 Definicionreloj.h ........................... 2
2.2 Definicion reloj.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2.3 Definicion main.cpp . . . . . . . . . . . . . . . . . . . . . . . . . 4
1
pf3
pf4

Vista previa parcial del texto

¡Descarga El derecho fundamental y más Esquemas y mapas conceptuales en PDF de Derecho Privado solo en Docsity!

Contents

  • 1 Introduction
  • 2 Definicion clase reloj
    • 2.1 Definicion reloj.h
    • 2.2 Definicion reloj.cpp
    • 2.3 Definicion main.cpp

clase reloj

JaB

May 2020

1 Introduction

Programas y ejemplos de uso de funciones en c++ y estructuras

2 Definicion clase reloj

2.1 Definicion reloj.h

1 // / c l a s e r e l o j 2 // / hora minuto y segundo 3 c l a s s R e l o j { 4 p r i v a t e : // / a t r i b u t o s 5 i n t hora , minuto , segundo ; 6 p u b l i c : 7 R e l o j ( ) ; 8 R e l o j ( i n t , i n t , i n t ) ; 9 v o i d m o s t r a r ( i n t ) ; 10 v o i d alarma ( i n t , i n t , i n t ) ; // /Nos i n d i c a cuanto f a l t a para que s u e n e n u e s t r a alarma 11 R e l o j o p e r a t o r +( R e l o j ) ; // /Sumaremos 2 h o r a s 12 13 i n t getHora ( ) ; // / r e c u p e r a r v a l o r 14 v o i d s e t H o r a ( i n t ) ; // / a s i g n a r un v a l o r ; 15 i n t getMinuto ( ) ; 16 v o i d s e t M i n u t o ( i n t ) ; 17 i n t getSegundo ( ) ; 18 v o i d s e t S e g u n d o ( i n t ) ; 19 } ;

2.2 Definicion reloj.cpp

1 #i n c l u d e ” r e l o j. h” 2 #i n c l u d e 3 u s i n g namespace s t d ; 4 // / [ t i p o de r e t o r n o ] [ c l a s e a l a que p e r t e n e c e ] : : [ nombre de l a f u n c i o n ] 5 R e l o j : : R e l o j ( ) { 6 hora = 0 ; 7 minuto = 0 ; 8 segundo =0;

66 67 h = hora + h ; 68 i f ( h >= 2 4 ) { 69 h −= 2 4 ; 70 } 71 R e l o j r e s p u e s t a ( h ,m, s ) ; 72 r e t u r n r e s p u e s t a ; 73 } 74 75 i n t R e l o j : : getHora ( ) { 76 r e t u r n hora ; 77 } 78 v o i d R e l o j : : s e t H o r a ( i n t h ) { 79 hora = h ; 80 } 81 82 i n t R e l o j : : getMinuto ( ) { 83 r e t u r n minuto ; 84 } 85 v o i d R e l o j : : s e t M i n u t o ( i n t m) { 86 minuto = m; 87 } 88 89 i n t R e l o j : : getSegundo ( ) { 90 r e t u r n segundo ; 91 } 92 v o i d R e l o j : : s e t S e g u n d o ( i n t segundo ) { 93 t h i s −>segundo = segundo ; 94 }

2.3 Definicion main.cpp

1 #i n c l u d e ” r e l o j. cpp ” 2 i n t main ( ) { 3 R e l o j A( 9 , 1 0 , 1 0 ) ; 4 R e l o j B( 1 9 , 3 0 , 1 ) ; 5 //A. m o s t r a r ( 2 0 ) ; 6 7 A. alarma ( 1 0 , 0 , 0 ) ; 8 r e t u r n 0 ; 9 }