Язык Turbo C 2.0
Перечисления */
/* 1 */
enum имя типа {список названий} список переменных;
enum seasons {win, spr, sum, aut};
enum seasons s;
printf ("%i, %i.\n", win, aut);
enum value {one = 1, two, three, ten = 10, thousand = 1000, next};
printf ("%i, %i, %i, %i, %i.\n", one, two, then, thousand, next);
typedef char symbol;
typedef unsigned unsign;
typedef float real;
struct st_tag avar;
student avar;
/* 2 */
typedef struct st_tag
{
char name [30];
int kurs;
char group [3];
int stip;
} student;
type gaz = {c, o, n, f};
metal = {fe, co, na, cu, zn};
var g1, g2, g3: gaz;
met1, met2: metal;
day: {sun, mon, tue, wed, thu, fri, sat};
if day = sun then writeln ("Ура! Сегодня выходной.");
/* 3 */
type numbers = 1..31;
alf = 'a'..'z';
var data: numbers;
bukva: alf;
enum {a, b, c, d};
enum {a = 10, b, c, d};
enum {a = 10, b = 20, c = 35, d = 100};
typedef double D;
enum metal {fe, co, na, cu, zn};
metal met1, met2;
met1 = na;
met2 = zn;
Присоединяйтесь — мы покажем вам много интересного
Присоединяйтесь к ОК, чтобы подписаться на группу и комментировать публикации.
Нет комментариев