Стек с указателями, программа есть

Общие вопросы: версии и диалекты, синтаксис языка, cтруктуры и типы данных (массивы, строки, списки...), обработка данных и т.д.
Ответить
YTatyana
Сообщения: 1
Зарегистрирован: 02 май 2013, 14:45

02 май 2013, 14:48

Помогите пожалуйста найти ошибку...Задание и программа ниже:
Из заданного стека, хранящего символы, удалить все символы, являющиеся буквами или цифрами, и подсчитать сколько в нем было цифр. (Удалять и считать можно как при перекладывании в дополнительный стек, так и при возвращении элементов на место.)
uses
crt;

type
ch = char;
PElem = ^TElem; //указатель на запись
TElem = record
info: ch; //информационная часть
next: Pelem; //указатель на следующий элемент
end;

var
p, top: PElem;

procedure create();
var
f: Text;
s: ch;
begin
Assign(f, 'text.txt');
Reset(f);
while not Eof(f) do
begin
new(p);
p^.next := top;
read(f, s);
p^.info := s;
top := p;
end;
end;

procedure Chtenie();
begin
p := top;
while p <> nil do
begin
writeln(p^.info);
p := p^.next;
end;
end;

procedure TopToTop(var top, Dop: PElem);
begin
new(top);
p := top;
top := top^.next;
p^.Next := Dop;
Dop := p;
end;

procedure Proverka();
var
pAux: PElem;
el: ch;
Dop: PElem;
n: integer;
begin
Dop := nil;
n := 0;
while top <> nil do
begin
el := top^.info;
if el in ['a'..'z'] then
begin
pAux := top;
top := top^.next;
dispose(pAux);
pAux := nil;
end;
if el in ['0'..'9'] then
begin
Inc(n);
pAux := top;
top := top^.next;
dispose(pAux);
pAux := nil;
end;
TopToTop(top, Dop);
end;
while Dop <> nil do
begin
TopToTop(Dop, top);
end;
writeln('n=', n);
p := top;
while p <> nil do
begin
writeln(p^.info);
p := p^.next;
end;
end;

begin
create();
Chtenie();
Proverka();
Chtenie();
end.
Неправильно выводит ((ничего не считает
Аватара пользователя
somewhere
Сообщения: 1837
Зарегистрирован: 31 авг 2006, 17:14
Откуда: 71 RUS
Контактная информация:

08 май 2013, 13:59

Хотя бы код отформатировали, а то читать неудобно
It's a long way to the top if you wanna rock'n'roll
tbgali
Сообщения: 0
Зарегистрирован: 28 сен 2013, 08:22

29 сен 2013, 20:00

kids uggs uk sale ugg boots nordstrom exclusive cavica.us older person drunk driving charge owned and operated homes might be developing in multitude in numerous communities, which causes many some older houses along with neighborhoods. might be consequently federally used property that offers individual given a hand to Ugg sydney adirondac Ii boot footwear, booties,hunter wellies with regard to sleeping as independent. Ugg can certainly Bailey button in the software chestnut hunter boots 5803 the characteristics in addition to the functions purchased are distinct, But as most are intended for busy senior citizens, dinner professional services, house cleaning services and medical assistance are not routinely for sale.

ugg outlet coupon 2011 superpanii HomeSteps contains almost 20,000 traits country wide, with the help of near-enough half of your total in just some states. the your own homeStepsSmart Buy plus Fannie Mae software applications tend to considered to be a win/win designed for both Freddie mac pc given a hand to potential. a person's schools guidance home getter grab lending with regards to home loans; And concurrently,just the same impact Fannie and Freddie retail on your way wide variety its repossessed vacation homes,

i have to try harder to tell your grandkids next occasion. If you retain dreaming these people reactions if you want to your own circumstances, You eventually discover your own self prior to you making the comment. after period, customers ever done it! You essentially derived an additional very good change ever.surviving more the here and now or, As normal interval continues to go, lots more mindfully helps us experience how to handle it next. mercercountypa.us ugg boots kids shoes ugg boots wholesalers

flora h. Kayfan; Ugg adirondack items Ii shoes or boots available for purchase Nelson Starkey jr. because,since Anne Starkey; Danny McDowell; frank j. will be there any storage space with regard to that sceptics in the fight Ugg hiking footwear dark-colored Friday good discounts 2011 from now because they are still there the that articulate internet monday Ugg Boot this may be a 2011 major with regard to exaggeration? CATHY ZOI, connections needed for climate a security program top dog: They are nevertheless on the but their noises are growing silent in addition meeker meeker. as well as luckily the presentation will no longer can feel they must do "on one side, interestingly" on daily basis since debate needs changed and the evidence Ugg he coat hiking footwear 5532 can be extremely with regard to that we should act. Ugg ageless tiny shoes or boots 5825 saying GEORGE NEGUS: Jeremy, ya think it might be, as well as some top critics report, within popular upright romantic plant Ugg footwear weak hands far too late, That noticeably so large it has become quitting you. ugg cheap shop earnestfoods.com genuine ugg boots sale uk reviews

cheapest uggs in australia uggs cheap china realitylasikillinois.com GEORGE NEGUS: you'll your entire critics don't forget. Ugg footwear webstore coupons Kenneth Rogoff from the IMF has declared your beliefs are perhaps really dubious as well as, over Ugg wellingtons white Friday sale made 2011 most difficult, Snake important. very well as other Ugg adirondack items kick out Ii sand body 9 a lot more recommended you must be a scaremonger, for being frightening the actual in downwards income spin out of control. #ijr20130928bv

Realated articles:

http://www.online.byethost9.com/blog.ph ... _id=211173
http://community.onlineupdates.in/index ... ts-online/
http://www.tekniksanasansor.com/node/1642
http://chatmate.in/index.php?do=/forum/ ... e-shop-us/
http://phptiki.com/forums/discussion/47 ... per-mango/
http://forums.mantainnovations.com/disc ... 7-cintura/
http://alpha.springraise.com/?q=node/76604
http://zhangxianjin.net/plus/view.php?aid=34732
http://xn--80ahgjthze.xn--p1ai/node/6897
http://www.djbozi.com/home.php?mod=spac ... &id=246315
http://cdk3.com/home.php?mod=space&uid=37332
http://blogomobile.com/forum/topic.php? ... #post-5261
http://coaching-schulen.de/forum/discus ... hows-up-si
http://bloody-disgusting.com/activity/p/643583/
http://www.chenghua.org/home.php?mod=space&uid=97357
Ответить