Sie sind auf Seite 1von 11

TECHNICAL UNIVERSITY OF MANAB FACULTY OF INFORMATICS SCIENCE ENGINEERING DEGREE IN COMPUTER SYSTEMS DATA STRUCTURE TASK # 2.

AUTHOR:
PAREDES BRAVO JONATHAN ANDRES

PROFESSOR:
MR. CHRISTIAN TORRES.

LEVEL:
SECOND "C"

PERIOD:
SEPTEMBER 2012 - FEBRUARY 2013

FACULTAD DE CIENCIAS INFORMTICAS

Mission:
Be a unit with high academic prestige, efficiency, transparency and quality in education, organized in their activities, protagonists of regional and national progress.

Vision:
Form efficient professionals and innovators in the field of computer science, giving answers to the needs of society with honesty, fairness and solidarity, raising their standard of living.

TECHNICAL UNIVERSITY OF MANAB

Mission:
Train academics, scientists and responsible professionals, humanist, ethical and supportive, committed to the objectives of national development, which will contribute to the solution of the problems of the country as university teaching with research, able to generate and apply new knowledge, fostering the promotion and dissemination of knowledge and cultures, provided for in the Constitution of the Republic of Ecuador.

Vision:
Be referent, leader and university institution of higher education in Ecuador, by promoting the creation, development, transmission and dissemination of science, technique and culture, social recognition and projection, regionally and globally.

FIRST EXERCISE
Calculate the monthly salary of an employee working hours, payment for each hour worked depends on your category: Category payment x hour (S /.) TO 35.60 B 33.40 C 28.45 In addition if the employee works more than 115 hours monthly has a bonus of 2.5% of salary. Use structures #include < conio.h > #include < stdio.h > #include < iostream.h > struct {} salary float total; float bonus; }; struct categoria_ {} char category; float a; float b; float c; }; struct data {} char name [50]; struct categoria_ category;

int hours; int dias_mes; struct varsueldo salary; } employee; void main) { Empleado.Categoria. to = 26. 90; Empleado.Categoria. b = 24. 30; Empleado.Categoria. c = 21. 50; clrscr(); printf("Ingrese el nombre deel empleado:"); scanf("%s",&empleado.nombre); printf("Ingrese numero de horas diarias de labor:"); scanf("%d",&empleado.horas); printf("Ingrese numero de das deel mes laborados:"); scanf("%d",&empleado.dias_mes); printf("Ingrese la categoria (A B o C):"); scanf("%s",&empleado.categoria.categor); employee hours = employee. hours * employee. dias_mes; if(empleado.categoria.categor=='a') {empleado.varsueldo total = employee. hours * employee category.;} if(empleado.categoria.categor=='b') {empleado.varsueldo total = employee. hours * employee. category b;}

if(empleado.categoria.categor=='c') {empleado.varsueldo total = employee. hours * employee. category c;} if(empleado.horas>=150) {empleado.varsueldo bonus = employee. varsueldo. total * 0. 05;} set Empleado.varsueldo total = employee. varsueldo. total+empleado. varsueldo. bonus; clrscr(); printf("Nombre deel empleado: %s\n",empleado.nombre); printf("horas laboradas: %d\n",empleado.horas); printf("dias ael mes laborados: %d\n",empleado.dias_mes); printf("Categoria: %c\n",empleado.categoria.catg); printf("Bono: %f\n",empleado.varsueldo.bono); printf("Total: %f\n",empleado.varsueldo.total); getch(); }

FIGURE: 1

By entering the name of an employee

FIGURE: 2

By entering the daily hours of work of the working

FIGURE:3

Entering the days of the month

FIGURE: 4

By entering the category of employee

FIGURE: 5

Printing of the worker worker data

SECOND EXERCISE
Definition of structure and handling of various structure to. Define a data type called TFECHA, with appropriate to store the day, month and year of the dates fields. b. Defines a data type called TCD with appropriate fields to save the name of the album, the singer or group, the date that it was purchased (must be of type TFECHA), and the type of music (Pop, Rock, etc.). c. Declare an array size type TCD25 MisCDs. d. Assign in the first position of the array MisCDs, the data corresponding to your favorite music album (if you don't remember the date in which it was purchased, can put any)

#include < conio.h > #include < iostream.h > #include < stdio.h > #include < string.h > struct TFECHA_ {int day; int month; int anio; }; struct TCD_ {char nom_album [100]; char interpreter [50]; struct TFECHA_ date; char genre [15]; }; struct TCD_ MisCds [30]; void main() { strcpy (MisCds [1] '. nom_album, "the ear of Ban Goh"); strcpy (MisCds [1] .interprete, "Don't you give up"); MisCds [1]. date day = 23; MisCds [1]. date month = 03; MisCds [1]. date anio = 2012; strcpy (MisCds [1] .genre, "POP"); printf ("\nombre of album:\t%s",MisCds[1].nom_album);

printf ("\nInterprete:\t \t %s",MisCds[1].interprete); printf("\nFecha:\t\t\t%d/%d/%d",MisCds[1].fecha.dia,MisCds[1].fecha.m es,MisCds[1].fecha.anio); printf ("\nGenero:\t \t \t %s",MisCds[1].genre); getch(); }

FIGURE: 6

Data from the album printing

Das könnte Ihnen auch gefallen