summaryrefslogtreecommitdiffstats
path: root/2022-2/L10/mitsuo/Medicamento.cpp
diff options
context:
space:
mode:
authorMitsuo Tokumori <[email protected]>2022-12-04 23:13:28 -0500
committerMitsuo Tokumori <[email protected]>2022-12-04 23:13:28 -0500
commit8e01ba134a230e47e8b80351dd8abc8c3b72e683 (patch)
tree3f0e174c80cc4a6e4a2aa2b5351f4dad66b49d89 /2022-2/L10/mitsuo/Medicamento.cpp
parentce58d6504665422a0817cf0ddb38fc533d0de33e (diff)
downloadLP1-8e01ba134a230e47e8b80351dd8abc8c3b72e683.tar.gz
LP1-8e01ba134a230e47e8b80351dd8abc8c3b72e683.tar.bz2
LP1-8e01ba134a230e47e8b80351dd8abc8c3b72e683.zip
Add my solution for L10
Diffstat (limited to '2022-2/L10/mitsuo/Medicamento.cpp')
-rw-r--r--2022-2/L10/mitsuo/Medicamento.cpp63
1 files changed, 63 insertions, 0 deletions
diff --git a/2022-2/L10/mitsuo/Medicamento.cpp b/2022-2/L10/mitsuo/Medicamento.cpp
new file mode 100644
index 0000000..7ab0da2
--- /dev/null
+++ b/2022-2/L10/mitsuo/Medicamento.cpp
@@ -0,0 +1,63 @@
+/*
+ * File: Medicamento.cpp
+ * Author: mitsuo
+ *
+ * Created on 02 December 2022, 12:31
+ */
+
+#include <iostream>
+#include <iomanip>
+#include "Medicamento.h"
+#include "aux.h"
+
+using namespace std;
+
+Medicamento::Medicamento() {
+ this->codigo = -1;
+ this->nombre = new char [MAXLEN];
+}
+
+Medicamento::Medicamento(const Medicamento& orig) {
+}
+
+Medicamento::~Medicamento() {
+ delete [] this->nombre;
+}
+
+void Medicamento::setPrecio(double precio) {
+ this->precio = precio;
+}
+
+double Medicamento::getPrecio() const {
+ return precio;
+}
+
+int Medicamento::getCodigo() const {
+ return codigo;
+}
+
+int Medicamento::lee(std::istream &input) {
+ char c;
+ input >> this->codigo >> c;
+ input.getline(this->nombre, MAXLEN, ',');
+ input >> this->stock >> c;
+ input >> this->precio >> c;
+
+// char s[MAXLEN];
+// input.getline(s, MAXLEN);
+
+ return !input.eof();
+}
+
+void Medicamento::imprime(std::ostream &output) {
+ output << WL(8) << this->codigo;
+ output << WL(40) << this->nombre;
+ output << WR(8) << this->stock;
+ output << WR(8) << this->precio;
+// output << '\n';
+}
+
+
+void Medicamento::actualiza(std::istream &input) {
+
+}