Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Samuel Oliveira
lp1-2020.5
Commits
89cab0e5
Commit
89cab0e5
authored
Jul 04, 2020
by
Samuel Oliveira
Browse files
Métodos adicionados
parent
bd183073
Changes
4
Hide whitespace changes
Inline
Side-by-side
a.out
View file @
89cab0e5
No preview for this file type
carro.cpp
View file @
89cab0e5
#include
"carro.hpp"
void
Carro
::
acelera
(
int
velocidade
){
this
->
velocidade
+=
velocidade
;
}
void
Carro
::
freia
(
int
velocidade
){
this
->
velocidade
-=
velocidade
;
}
\ No newline at end of file
carro.hpp
View file @
89cab0e5
...
...
@@ -7,4 +7,8 @@ class Carro{
string
tipo
;
string
placa
;
int
numPortas
;
int
velocidade
;
void
acelera
(
int
velocidade
);
void
freia
(
int
velocidade
);
};
\ No newline at end of file
main.cpp
View file @
89cab0e5
...
...
@@ -12,4 +12,10 @@ int main(){
cout
<<
"Tipo do carro: "
<<
c
.
tipo
<<
endl
;
cout
<<
"Quantidade de portas: "
<<
c
.
numPortas
<<
endl
;
cout
<<
"Placa do carro: "
<<
c
.
placa
<<
endl
;
c
.
acelera
(
50
);
cout
<<
"A velocidade atual é: "
<<
c
.
velocidade
<<
"KM/H"
<<
endl
;
c
.
freia
(
20
);
cout
<<
"A velocidade atual é: "
<<
c
.
velocidade
<<
"KM/H"
<<
endl
;
return
0
;
}
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment