From 387642ff612de7d0ebf09410cd8e39a4765c877a Mon Sep 17 00:00:00 2001 From: Mitsuo Tokumori Date: Fri, 18 Aug 2023 01:57:48 -0500 Subject: Fix naming. Add leading 0 to lab names --- 2023-2/L0/fun.cpp | 72 ------------------------------------------------------- 1 file changed, 72 deletions(-) delete mode 100644 2023-2/L0/fun.cpp (limited to '2023-2/L0/fun.cpp') diff --git a/2023-2/L0/fun.cpp b/2023-2/L0/fun.cpp deleted file mode 100644 index e317db3..0000000 --- a/2023-2/L0/fun.cpp +++ /dev/null @@ -1,72 +0,0 @@ -#include // I/O basico (left, right, hex, oct, [no]uppercase, showbase) -#include // manipuladores (setw, setprecision, setfill) -#include -#include -#include "fun.h" - -#define MAXLEN 100 - -using namespace std; - -void leer_datos_escribir_reporte(std::istream& in, std::ostream& out) { - int sum_qty; - double sum_price; // (price * qty) - - char code[MAXLEN]; - char book_name[MAXLEN]; - char author_name[MAXLEN]; - int qty; - double unit_price; - char c; // dummy - - sum_qty = 0; - sum_price = 0.0; - print_header(out); - int i; - for (i = 0; true; i++) { - // read - in.getline(code, MAXLEN, ','); - in.getline(book_name, MAXLEN, ','); - in.getline(author_name, MAXLEN, ','); - in >> qty; - in >> c; - in >> unit_price; - in.ignore(MAXLEN, '\n'); - if (!in) { - break; - } - // process - to_upper_cstring_inplace(book_name); - sum_qty += qty; - sum_price += qty * unit_price; - - // write - out << setw(2) << right << setfill('0') << i + 1 << ") "; - out << left << setfill(' '); - out << setw(8) << code; - out << setw(32) << uppercase << book_name; - out << setw(32) << author_name; - out << right << setprecision(2) << fixed; - out << setw(4) << qty; - out << setw(4) << ' '; - out << setw(8) << unit_price; - out << '\n'; - } - - out << "\n\n"; - out << "Total cantidad libros: " << sum_qty << '\n'; - out << "Total valor libros: " << sum_price << '\n'; -} - -void print_header(ostream& out) { - // 8 32 32 4 8 - out << "No. Codigo Nombre Autor Cant. Precio \n"; - out << "----------------------------------------------------------------------------------------------\n"; -} - -void to_upper_cstring_inplace(char * s) { - int i; - for (i = 0; s[i] != '\0'; i++) { - s[i] = toupper(s[i]); - } -} \ No newline at end of file -- cgit v1.2.3