66547

Разработка и отладка алгоритмов и программ c использованием структур данных

Лабораторная работа

Информатика, кибернетика и программирование

Цель работы: Получить практические навыки в разработке алгоритмов и написании программ на языке С с использованием структур данных. Оборудование: IBM – совместимый компьютер, Система программирования QC 2.5.

Русский

2014-08-22

87.42 KB

1 чел.

Лабораторная работа  №  5

Разработка и отладка алгоритмов и программ c использованием структур данных

Цель работы: Получить практические навыки в разработке алгоритмов и написании программ на языке С с использованием структур данных.

Оборудование: IBM – совместимый компьютер, Система программирования QC 2.5.

Индивидуальное задание

Вариант 1

№ варианта

Наименование таблицы

Поля структуры

Поля объединения

4

Каталог магнитофонов

  1.  Модель
  2.  Цена
  3.  Объединение
  1.  Максимально количество записываемых передач(для видео магнитофона)
  2.  Выходная мощность усилителя ( для аудио магнитофонов)

Графическая схема задачи 1

Исходный модуль задачи 1

#include "stdafx.h"

struct avto{

char name[10];

char r[50];

union {

char v[15];

char gr[30];}m;

};

int n,i,k;

void main(void)

{

struct avto mas[30];

printf("Vvedite kol-vo zapisey:");

scanf("%d",&n);

getchar();

for(i=1;i<=n;i++)

{

printf("Vved %d zapis'\n",i);

printf("mogel: ");

gets(mas[i].name);

printf("cena: ");

gets(mas[i].r);

printf("audio magnutofon(0-ne or 1-da):");

scanf("%d",&k);

getchar();

if(k==0)

{printf("max kol-vo zanuc nepeda4(video magnutofon):");

gets(mas[i].m.v);}

if(k==1)

{printf("vixoghai mochnoctb yculuteli (audio mgnitofon):");

gets(mas[i].m.gr);} }

getchar();

printf("mogel   cena   kol-vo nepeda4(video magnutofon) /mochnoctb  (audio mgnitofon)\n");

for(i=1;i<=n;i++)

printf("%s     %s          %s\n",mas[i].name,mas[i].r,mas[i].m.v,mas[i].m.gr);

}


 

А также другие работы, которые могут Вас заинтересовать

84394. Zahiriddin Muhammad Bobur (1483-1530) 282.75 KB
  In 1494 when Bobur was only 12 years old, he became a ruler. In 1503–1504 he conquered Afghanistan. During 1519 – 1525s he tried to conquer India five times. He became the founder of Bobur’s Empire which lasted more than three centuries (1526-1858).
84395. Mirzo Ulugh Beg (1394-1449) 437.58 KB
  Ulugh Beg 1394-1449 Tartar Astronomer and Mathematician Ulugh Beg made Samarkand one of the leading cultural and intellectual centers of the world. In that city he established a madrasa (Islamic institution of higher learning) that emphasized astronomical studies.
84397. Abu Ali Ibn Sino (Avicenna) (980-1037) 819.35 KB
  Abu Ali Ibn Sino is the pride of Central Asia and one of the greatest scientists. Besides medicine he was occupied with mathematics, logic and philosophy. He was born in Bukhara in the village of Afshana in 980 and got his education in Bukhara.
84398. Abu Ali Ibn Sino 28.98 KB
  Abu Ali Ibn Sino is well-known in Europe by the name of “Avicenna” the naturalist Karl Linney named a type of plant “Avicenna” in honour of him. To sum up we can say that Abu Ali Ibn Sino was an encyclopaedic school whose contribution to world civilization was incomparable.
84399. Kamoliddin Behzod (1455-1537) 30.91 KB
  The member of Renaissance and Alisher Navoi’s apprentice, the great artist and miniaturist Kamoliddin Behzod was born in 1455 in poor family in Heart. He lost his parents as a child and was brought up by the famous painter Mirak Nakkosh. He learned from him the secrets of carving.
84400. Outstanding people of Uzbekistan Abu-Rayhon Beruniy 117.38 KB
  Abu-Rayhon Beruniy – a remarkable scientist, amazing with variety of his scientific interests, boldness of idea, the author of more than 150 works devoted to actual issues of natural sciences, philosophy, history, philology, great encyclopaedist – the thinker, the humanist of the Middle Ages epoch.
84401. Muhammad ibn Muso al-Khorazmiy 164.28 KB
  Muhammad ibn Muso al-Khorazmiy (783 - 850) Nickname Al – Khorezmi specifies his native land – the Central Asian state Khoresm (nowadays territory of Uzbekistan), Bin Mussa – son of Mussa, and one of nicknames of the scientist – Al – Madjusi– speaks about his origin from a sort of magicians...
84402. Alisher Navoi (1441-1501) 163.92 KB
  An ingenious poet and the thinker, the musician and the artist, the teacher and the scientist, a great statesman and one of the most cultural persons of his time. Alisher Navoi was the conventional head of the cultural life of Herat, the patron of numerous representatives of sciences, arts and cultures.