Sistema para guardar información de maestros y sus materias ¡Practicando con AzulSchool! [ESP-ENG] | C++

¿Qué tal? Por acá estoy de vuelta con más programación en torno al curso de C++ gratuito que está disponible en AzulSchool y que como bien he mencionado, estoy decidido a completar. Han habido altibajos pero seguimos adelante, como siempre digo.

El proyecto de hoy corresponde al número 8/9 del curso y actualmente llevo un 92% completado del mismo. Este proyecto se centra en poner en practica lo aprendido en el apartado de estructuras, por ello empieza indicando que debe ser posible guardar los datos de los maestros, es decir, nombre, edad, país, especialidad. En el apartado de especialidad habrán tres posibles opciones: Programación, Bases de Datos y Servidores.

También se habla de la fecha del curso (día, mes y año) y también del propio curso en sí, que debe incluir todos los datos anteriores. El usuario debe poder buscar por el nombre del maestro, la especialidad, los cursos mayores y menores a un año de publicación y también debe existir un apartado que de acceso a modificar los datos antes registrados (en el código), por parte del usuario. Pero para acceder debe exigirse una contraseña.

Para comenzar estuve leyendo un poco el foro del curso, para apoyarme en los consejos allí registrados y ver qué tal les fue a otros estudiantes del curso. Habiendo consultado esta información para evitar algunos estancamientos y errores, pasé al compilador. Como siempre, las librerías primero, "iostream" para la entrada y salida de datos, "conio.h" para las pausas y limpiezas de pantalla y "string.h" para manejar las cadenas.

Las estructuras fueron "Date" para la fecha, con tres enteros para el día, mes y año. "Teacher" para los profesores, con tres cadenas de caracteres para el nombre, especialización y país, además de un entero para la edad. La última estructura fue Course para el curso en sí, con una cadena para el nombre y dos estructuras anidadas una de tipo "Teacher" y otra de tipo "Date", para que manipular todo en un solo "bloque"/estructura de tipo Curso. Trato de emplear más el inglés para familiarizarme, pues en programación es el idioma por excelencia.

Ubiqué una declaración global de un arreglo de estructuras de tipo Curso, pues para que el programa fuese más detallado hacían falta varios registros. En concreto 8 (0-7), en los que traté de se preciso al buscar cursos de la propia página AzulSchool, a excepción del último que es una autoinserción, pues me gustaría en un futuro impartir cursos de computación básica.

La primera función fue "data_registration()", y como bien su nombre lo indica, se encarga del registro de la información de cada curso. Como mencionaba, 7/8 cursos son reales, los nombres también, las fechas de publicación igual, los países de origen también pero las especializaciones y edades no, pues esta información no la encontré presente en la página, por lo que no es precisa.

How are you doing? Here I am back with more programming around the free C++ course that is available at AzulSchool and as I mentioned, I am determined to complete. There have been ups and downs but we keep going, as I always say.

Today's project is number 8/9 of the course and I am currently 92% complete. This project focuses on putting into practice what was learned in the section on structures, so it begins by indicating that it should be possible to save the data of the teachers, i.e. name, age, country, specialty. In the specialty section there will be three possible options: Programming, Databases and Servers.

The date of the course (day, month and year) and also the course itself, which should include all the above data, are also mentioned. The user should be able to search by the name of the teacher, the specialty, the courses older and younger than one year of publication and there should also be a section that gives the user access to modify the data previously recorded (in the code). But a password should be required for access.

To begin with, I have been reading the course forum a bit, to rely on the tips registered there and to see how other students of the course have done. Having consulted this information to avoid some deadlocks and errors, I moved on to the compiler. As always, the libraries first, "iostream" for data input and output, "conio.h" for pausing and screen clearing and "string.h" to handle strings.

The structures were "Date" for date, with three integers for day, month and year. "Teacher" for teachers, with three strings for name, major and country, plus an integer for age. The last structure was Course for the course itself, with a string for the name and two nested structures, one of type "Teacher" and one of type "Date", so that I manipulate everything in a single "block"/structure of type Course. I try to use more English to familiarize myself, because in programming it is the language par excellence.

I located a global declaration of an array of structures of type Course, because for the program to be more detailed, several records were needed. Specifically 8 (0-7), in which I tried to be precise when looking for courses from the AzulSchool page itself, except for the last one which is an autoinsertion, because I would like to teach basic computer courses in the future.

The first function was "data_registration()", and as its name indicates, it is in charge of registering the information of each course. As I mentioned, 7/8 courses are real, the names are real, the dates of publication are real, the countries of origin are real, but the specializations and ages are not real, because I did not find this information on the page, so it is not accurate.


Portada post programacion, tech.png

Edited with CANVA

Programación c++.png

image.png

image.png

image.png

image.png

image.png

Programación c++.png

Para la siguiente función "Show_Data", empezamos a reciclar, pues es una hermana de la función que he venido usando en varios proyectos como plantilla para mostrar información agrupada. Cambian solo los parámetros. Sigue "specialization_Selector" que a decir verdad le puse un nombre muy largo, aunque lo describe bien, es un bucle con switch-case que sirve a modo de selector de especialidades para la búsqueda en el menú principal. Se apoya en Search_repeat_spec, que busca secuencialmente si hay coincidencias a partir de un parámetro "target", que es predefinido según las tres posibilidades presentes. "Search_repeat_name" es también gemela de "Searh_repeat_spec" solo que se enfoca en los nombres, para la otra opción del menú que permite filtrar según el nombre del profesor que imparte el curso.

Sigue "year_colector" que funciona para recoger y validar el año actual que debe ingresar el usuario por teclado, para compararlo con los años de publicación y así poder mostrar los registros según cuáles cursos tienen más de un año de haberse publicado y cuáles menos de un año. Para ello aparece la función "year_filter" que hace la resta en función del criterio que se representa con una variable booleana para saber si será n < 1 o n > 1.

Como el año del curso de Computación básica es 2024, parece desfasado en la muestra de ejecución, pues el año ingresado fue 2022, pero esto fue a propósito para poner a prueba ese apartado en comparación a los cursos del 2019 y 2020 que son la mayoría.

En este proyecto no validé tanto como acostumbro, porque me habría tomado mucho tiempo que actualmente no tengo disponible, sin embargo, para el ingreso de año apliqué un apartado que evita que los caracteres no numéricos pasen e interrumpan el flujo de ejecución, este algoritmo no fue mío sino que lo encontré en una página que lo resumía bastante bien, se llama "Techi DeLight", en su artículo "Convertir una cadena string a int en c++".

For the following function "Show_Data", we begin to recycle, because it is a sister of the function that I have been using in several projects as a template to show grouped information. Only the parameters change. It follows "specialization_Selector" that to tell the truth I gave it a very long name, although it describes it well, it is a loop with switch-case that serves as a selector of specialties for the search in the main menu. It relies on Search_repeat_spec, which searches sequentially for matches based on a "target" parameter, which is predefined according to the three possibilities present. "Search_repeat_name" is also a twin of "Searh_repeat_spec" only that it focuses on names, for the other menu option that allows filtering according to the name of the teacher teaching the course.

It is followed by "year_collector" which works to collect and validate the current year that the user must enter by keyboard, to compare it with the years of publication and thus be able to display the records according to which courses are more than a year old and which are less than a year old. For this purpose, the function "year_filter" appears, which does the subtraction according to the criterion that is represented by a Boolean variable to know if it will be n < 1 or n > 1.

As the year of the Basic Computing course is 2024, it seems out of date in the execution sample, as the year entered was 2022, but this was on purpose to test that section in comparison to the 2019 and 2020 courses which are the majority.

In this project I did not validate as much as I usually do, because it would have taken me a lot of time that I currently do not have available, however, for the year entry I applied a section that prevents non-numeric characters to pass and interrupt the execution flow, this algorithm was not mine but I found it in a page that summarized it quite well, it is called "Techi DeLight", in his article "Convert a string to int in c++".

Programación c++.png

image.png

image.png

image.png

image.png

image.png

image.png

Programación c++.png

Sigue interfaz_Colect que es una plantilla que nos ha acompañado en muchos proyectos, poco tengo que decir al respecto. "modification_option" por otro lado, se encarga de permitir la modificación de los datos registrados en los cursos, pero para dar a lugar esa opción primero se debe elegir que curso se quiere editar, partiendo de su nombre. Luego el parámetro entre 6 posibles casos en los que la fecha se divide en 3 más, a través de otro selector anidado.

Finalmente la función que reúne todas las funciones anteriores y cuyo nombre no ha variado en varios proyectos, pues al fin y al cabo, es la misma base. Se trata del "menu", cuya primera función permite filtrar los cursos por el nombre del profesor, através de la función "Search_repeat_name", getline e "interfaz_Colect". Le sigue la número 2 que permite filtrar según especialidad, que se apoya en "specialization_Selector". La 3 se enfoca en buscar los cursos con más de un año de publicación, a través de "year_filter" y la 4 es su gemela que muestra los cursos con menos de un año de publicación, variando únicamente en el parámetro "criterio" de la misma función.

Para la quinta opción se introduce la dinámica de la contraseña, es decir, para poder modificar se debe ingresar la contraseña correcta. De lo contrario, no será posible acceder a ese apartado. La contraseña que elegí fue "Qwerty2022*", como se muestra también en el gif de ejecución.

Si se ingresa correctamente se accede a "modification_option", para cambiar el parámetro deseado del curso a partir de su nombre. Para la última opción (6), añadí una apartado que el enunciado no pide pero que consideré necesario para analizar mejor el funcionamiento del programa, este es "Mostrar todos los registros".

It follows interface_Colect which is a template that has accompanied us in many projects, I have little to say about it. "modification_option" on the other hand, is responsible for allowing the modification of the data recorded in the courses, but to give rise to that option you must first choose which course you want to edit, starting from its name. Then the parameter between 6 possible cases in which the date is divided into 3 more, through another nested selector.

Finally the function that brings together all the previous functions and whose name has not changed in several projects, because after all, it is the same base. This is the "menu", whose first function allows to filter the courses by the name of the teacher, through the function "Search_repeat_name", getline and "interface_Colect". It is followed by number 2, which allows filtering by specialty, supported by "specialization_Selector". Option 3 focuses on searching for courses with more than one year of publication, through "year_filter" and option 4 is its twin, which shows courses with less than one year of publication, varying only in the "criterion" parameter of the same function.

For the fifth option the password dynamics is introduced, i.e. the correct password must be entered in order to be able to modify. Otherwise, it will not be possible to access this section. The password I chose was "Qwerty2022*", as also shown in the run gif.

If entered correctly you access "modification_option", to change the desired course parameter from its name. For the last option (6), I added a section that the statement does not ask for but that I considered necessary to better analyze the operation of the program, this is "Show all records".

Programación c++.png

image.png

image.png

image.png

image.png

image.png

image.png

image.png

image.png

image.png

image.png

image.png

Programación c++.png

record_000060.gif

Programación c++.png

¡Y bueno... Eso es todo por hoy! Ya estamos a 8% de acabar el curso, me parece emocionante ya estar tan cerca. Cada proyecto va escalando en dificultad aunque el que sigue me parece que será mucho más familiar.

Espero que este contenido te haya sido de provecho, si conoces a alguien que consideres que le ayude también, no dudes en compartirlo. Si tienes aportes, correcciones, consejos o algo que agregar, será bien recibido, no dudes en compartirlo por los comentarios.

And well... That's all for today! We are already 8% away from the end of the course, I find it exciting to be so close. Each project is getting more and more difficult, although the next one will be much more familiar.

I hope this content has been useful for you, if you know someone that you think it will help them too, don't hesitate to share it. If you have contributions, corrections, tips or something to add, it will be well received, feel free to share it in the comments.

Programación c++.png


Redes actualizada.gif


Puedes seguirme por acá si lo deseas:
You can follow me here if you want:

Cuenta secundaria
(Dibujos, edición y juegos) | Secondary account (Drawings, editing and games)



0
0
0.000
10 comments
avatar

Un poco complicado para mi pero gracias por compartir tus ablilidades de programacio para la gente que no quiere aprender.

0
0
0.000
avatar

Información bastante interesante. Felicidades por tu progreso. Adelante y muchos éxitos @gabrielr29

!PIZZA

0
0
0.000
avatar

I can already see that you have excellent programming skills. Some people find programming, or rather computer science, very difficult. In my student days (1989) I received meritorious grades in Basic, Fortran, Pascal, etc. classes. Nowadays there are other technologies and several programming languages that are more utilitarian.
I wish you success in your studies!
Regards @gabrielr29


Ya observo que posees excelente facilidad para programar. Para algunas personas le es muy dificil la programación o mejor dicho la informática. Yo en mi época de estudiante (1989) recibía calificaciones meritorias en las clases de Basic, Fortran, Pascal, etc. En la actualidad existe otras tecnologías y varios lenguajes de programación que son más utilitarios.
Te deseo éxito en tus estudios!
Saludos @gabrielr29

0
0
0.000
avatar

¡Gracias! La verdad ha sido un proceso algo pesado por la naturaleza de la programación, pero gratificante cuando el código compila jajaja.

He escuchado de Pascal varias veces, en una ocasión una profesora me dijo que fue de los lenguajes más complicados que le toco enfrentar. En lo personal no lo he tocado aun, pero me resulta interesante que tenga tanto tiempo, yo la verdad no había nacido aun para esa fecha que me presenta; me honra recibir esas palabras de alguien que lleva más tiempo en el área. Saludos y mucho éxito para usted también.

0
0
0.000