Tipos de Dato Estructurados

Que honda:
Mi pregunta es la siguiente :
He buscado por la red el tema de "Tipos de Dato Estructurados" y no lo he encontrado;solo se que son seis tipos de dato pero no se su nombre ni su funcion, y ocupo todo lo relacionado con ellos.
Espero me puedas ayudar.
Gracias
Respuesta
1
Tipos estructurados de datos:
Yo tampoco sé cuales son estos tipos estructurados, pero quizá esto te ayude:
Structured Data Types
Administrative details
Typedef and typedef examples (Text: 9.1)
Arrays (Text: 7.1-7.3, 7.6, 7.7, 7.9)
Motivation for the use of arrays
Declaration of arrays
Example of the use of arrays
Typedef with arrays
Structures (Text: 9.1, 9.5, 9.6)
Motivation for the use of structures
Declaration of structures
Example of a structure and an array of structures
Enumerated types (Text: Appendix E)
Examples using enum
Alarm on test day example
Typedef Examples
/********************************
ENG 1D04 Typedef syntax
NAME:¿ ?
STDNUM:¿ ?
DATE:¿ ?
PURPOSE: To show examples of typedef
NOTE: This program does not "do" anything
********************************/
/* the syntax of typedef is:
typedef type-specified type-name */
/* typedef examples */
typedef float real;
typedef int boolean;
typedef long int quantity;
void main(void)
{
real x, y;
boolean test1, test2;
quantity alpha, beta;
/* etc. */
}
Array Example
/********************************
ENG 1D04 Array Example
NAME:¿ ?
STDNUM:¿ ?
DATE:¿ ?
PURPOSE: To calculate the average mark
********************************/
#include <stdio.h>
#define NUMSTDNT 5
void main(void)
{
/* variable declarations and initialization */
double gpa[NUMSTDNT]= {98.5, 87.5, 92.5, 79.0, 84.3};
double total;
double average;
int i;
/* process and calculate */
total = 0.0;
for (i=0; i < NUMSTDNT; i = i + 1)
{
total = total + gpa;
}
average = total/NUMSTDNT;
/* output */
printf("\nTotal : %.2f \n", total);
printf("Avg : %.2f \n", average);
}
Typedef and Arrays
/********************************
ENG 1D04 Typedef with Arrays Example
NAME: ???
STDNUM: ???
DATE: ???
PURPOSE: The program does not "do" anything
********************************/
#define NUMSTDNT 368
#define MAXN 25
/* typedef examples */
typedef double Marks[NUMSTDNT];
typedef char String5[5];
typedef float vectorT[MAXN];
typedef float matrixT[MAXN][MAXN];
void main(void)
{
Marks chem1E3, eng1d4, gpa;
String5 smallWord;
vectorT v1, v2;
matrixT m1, m2;
/* etc. */
}
Structure Example
/********************************
ENG 1D04 Structure Example
NAME: ???
STDNUM: ???
DATE: ???
PURPOSE: The program shows some structures for dates
********************************/
#include <stdio.h>
typedef struct
{
int month;
int day;
int year;
} date_t;
void main(void)
{
date_t today;
date_t birth;
birth.month = 12;
birth.day = 28;
birth.year = 1972;
printf("\nBirthday is %d/%d/%d\n", birth.month, birth.day, birth.year);
today = birth;
printf("\nToday is %d/%d/%d\n", today.month, today.day, today.year);
}
Array of Structures
/********************************
ENG 1D04 Array of Structures Example
NAME:¿ ?
STDNUM:¿ ?
DATE:¿ ?
PURPOSE: The program illustrates the syntax for an array of structures
********************************/
/* Declaring an array of structures is the same as
declaring an array of any other variable type */
typedef struct
{
long idnum;
char name[20];
float rate;
} payRec;
void main(void)
{
payRec employee[10];
/* example assignment statement */
employee[2].idnum = 1234567;
}
Enum Examples
/********************************
ENG 1D04 Examples of Enum
NAME:¿ ?
STDNUM:¿ ?
DATE:¿ ?
PURPOSE: The program illustrates enumerated ordinal types
NOTE: The program does not "do" anything
********************************/
typedef enum {sun, mon, tue, wed, thu, fri, sat} weekday;
typedef enum {FALSE, TRUE} boolean;
typedef enum
{
BELL = '\a',
BACKSPACE = '\b',
TAB = '\t',
NEWLIN = '\n',
RETURN = '\r'
} escapes;
typedef enum {JAN=1, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP,
OCT, NOV, DEC} months;
/* FEB is 2, MAR is 3, etc. */
void main(void)
{
boolean b1;
escapes escChar;
weekday day;
/* etc. */
}
Alarm on Test Day
/********************************
ENG 1D04 Another Enum Example
NAME:¿ ?
STDNUM:¿ ?
DATE:¿ ?
PURPOSE: The program illustrates enumerated ordinal types
NOTE: The program is like a dayplanner with an "alarm"
for the test day
********************************/
#include <stdio.h>
typedef enum {sun=1, mon, tue, wed, thu, fri, sat} weekday;
void main(void)
{
weekday day;
for (day = sun; day <= sat; ++day)
{
printf("The day num is %d\n",day);
if (day==thu)
{
printf("TestDay!!\n\a");
}
}
}

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas