Skip to content

Commit cfb07ca

Browse files
author
Miguel Bayon
committed
Picked up these exercises again
0 parents commit cfb07ca

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+16476
-0
lines changed

CCC '18/LVL4/Level4.pdf

789 KB
Binary file not shown.

CCC '18/lvl1/Level1.pdf

804 KB
Binary file not shown.

CCC '18/lvl2/Level2.pdf

791 KB
Binary file not shown.

CCC '18/lvl3/Level3.pdf

791 KB
Binary file not shown.

CCC '18/lvl3/lvl3-4.inp

Lines changed: 3786 additions & 0 deletions
Large diffs are not rendered by default.

CCC '18/lvl3/lvl3-5.inp

Lines changed: 4046 additions & 0 deletions
Large diffs are not rendered by default.

ejemplos/Punto.h

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#ifndef NAME
2+
#define NAME
3+
#include <iostream>
4+
5+
class Punto{
6+
public:
7+
Punto(int newX, int newY);
8+
Punto();
9+
int getX();
10+
int getY();
11+
void setX(int newX);
12+
void setY(int newY);
13+
void printPunto();
14+
private:
15+
int x, y;
16+
};
17+
18+
Punto::Punto(int newX, int newY){
19+
x = newX;
20+
y = newY;
21+
}
22+
23+
Punto::Punto(){
24+
x = 0;
25+
y = 0;
26+
}
27+
28+
int Punto::getX(){
29+
return x;
30+
}
31+
32+
int Punto::getY(){
33+
return y;
34+
}
35+
36+
void Punto::setX(int newX){
37+
x = newX;
38+
}
39+
40+
void Punto::setY(int newY){
41+
y = newY;
42+
}
43+
44+
void Punto::printPunto(){
45+
std::cout << "(" << x << "," << y << ")" << "\n";
46+
}
47+
#endif

ejemplos/Punto.h.gch

8.34 KB
Binary file not shown.

ejemplos/a.out

13.3 KB
Binary file not shown.

ejemplos/ejemplo.cpp

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#include <iostream>
2+
#include "Punto.h"
3+
4+
int main(){
5+
// Constructor con parametros
6+
Punto p1(1, 2);
7+
// Si usas un constructor sin argumentos, no se ponen parentesis
8+
Punto p2;
9+
10+
std::cout << "Valores iniciales:\n";
11+
p1.printPunto();
12+
p2.printPunto();
13+
14+
p1.setX(6);
15+
p1.setY(6);
16+
17+
p2.setX(7);
18+
p2.setY(7);
19+
20+
std::cout << "Valores finales:\n";
21+
p1.printPunto();
22+
p2.printPunto();
23+
24+
p1 = p2;
25+
26+
std::cout << "Asignacion (p1=p2):\n";
27+
p1.printPunto();
28+
p2.printPunto();
29+
30+
return 0;
31+
}

0 commit comments

Comments
 (0)