|
|
Регистрация Восстановить пароль |
Регистрация | Задать вопрос |
Заплачу за решение |
Новые сообщения |
Сообщения за день |
Расширенный поиск |
Правила |
Всё прочитано |
|
|
Опции темы | Поиск в этой теме |
04.06.2009, 17:08 | #1 |
Форумчанин
Регистрация: 03.05.2009
Сообщений: 112
|
двусвязные списки
Написал программу,а она не запускается. И ошибок не выдает. Подскажите пожайлуста что не так сделал.
Разработать программу для создания и работы с двусвязным списком, состоящим из структур. Для работы со списком создать меню со следующими пунктами: 1. Создание списка. 2. Просмотр списка. 3. Добавление в конец списка новой структуры. 4. удаление записи. 5. Выход. Структура содержит название, цену, количество товара. Удалить из списка заданный товар. Код:
|
04.06.2009, 17:29 | #2 |
В тени
Старожил
Регистрация: 19.12.2008
Сообщений: 5,788
|
У вас функции объявлены без параметров:
Код:
Код:
Код:
Код:
Вполне очевидно, чтобы что-то понять, необходимо книги читать.
Не нужно плодить бессмысленных тем. Вас Поиск избавит от многих проблем. ___________________________________ ___________________________________ _______ [=Правила форума=]_____[Поиск]_____[Литература по С++]____[Литература. Паскаль] |
05.06.2009, 19:59 | #3 |
Форумчанин
Регистрация: 03.05.2009
Сообщений: 112
|
Программу переделал. Пункт в меню выбираю и все начинает мелькать.
Подскажите в чем дело. Код:
|
05.06.2009, 20:19 | #4 |
В тени
Старожил
Регистрация: 19.12.2008
Сообщений: 5,788
|
У вас в меню:
Код:
Код:
Вполне очевидно, чтобы что-то понять, необходимо книги читать.
Не нужно плодить бессмысленных тем. Вас Поиск избавит от многих проблем. ___________________________________ ___________________________________ _______ [=Правила форума=]_____[Поиск]_____[Литература по С++]____[Литература. Паскаль] |
06.06.2009, 12:31 | #5 |
Форумчанин
Регистрация: 03.05.2009
Сообщений: 112
|
Выбираю ввод списка,ввожу данные,а просмотр показывает,что ничего не ввел.
Может ввод списка не работает? Подскажите. Код:
|
06.06.2009, 14:42 | #6 |
В тени
Старожил
Регистрация: 19.12.2008
Сообщений: 5,788
|
Вы посылаете в функцию список:
Код:
Код:
Код:
Вполне очевидно, чтобы что-то понять, необходимо книги читать.
Не нужно плодить бессмысленных тем. Вас Поиск избавит от многих проблем. ___________________________________ ___________________________________ _______ [=Правила форума=]_____[Поиск]_____[Литература по С++]____[Литература. Паскаль] |
06.06.2009, 14:46 | #7 |
Регистрация: 08.12.2008
Сообщений: 6
|
List* itsFirst=0;
List* itsLast=0; Тут идет переопределение типа указателей на итем на лист.Нужно менять лист на итем. theList.itsLast - Желательно во всех подобных конструкциях использовать конструкцию theList->itsFirst theList->itsLast Если все это не поможет,то следует менять логику программы. Поможем. |
06.06.2009, 15:40 | #8 |
Форумчанин
Регистрация: 03.05.2009
Сообщений: 112
|
Исправил. Теперь ввод работает,добавление работает,просмотр не работает. Только после добавления показывает добавленные товары.
Код:
|
06.06.2009, 15:50 | #9 |
Форумчанин
Регистрация: 03.05.2009
Сообщений: 112
|
Посмотрите.... там наверно CreateList не правильно работает.. а просмотр и добавление нормально.... если добавлять то выведет только то что добавил... без того что ввел при создании.
|
06.06.2009, 16:15 | #10 |
Регистрация: 08.12.2008
Сообщений: 6
|
Не смотря сразу скажу,что самое больное место в 2-х связных списках ,Это создание первого элемента,где конкретно инициализируется основная масса переменных и далее идет все от него.
Покажите последний обновленый код. Если так void CreateList (List*& theList),лучше сделать void CreateList (List** theList), то вызов будет CreateList (&theList); Измените трактовку слова указатель на слово адресс и станет легче ориентироваться . Последний раз редактировалось Timofey; 06.06.2009 в 16:52. |
|
Похожие темы | ||||
Тема | Автор | Раздел | Ответов | Последнее сообщение |
Списки C++ | paladinn | Помощь студентам | 1 | 27.05.2009 12:31 |
Двусвязные списки | Serp | Помощь студентам | 3 | 14.04.2009 16:13 |
списки | Влдислаав3911 | Паскаль, Turbo Pascal, PascalABC.NET | 5 | 10.05.2008 17:35 |