1
|
Програмиране / Общ форум / Помощ за сортиране на едносвързан списък
|
-: Nov 29, 2011, 12:43
|
Здравейте. Трябва да сортирам списък(по намаляващ ред на полето step) реализиран чрез указатели. Нещо обърквам при сортирането и не мога да разбера какво е то. Дебъгера казва, че има проблем при: return a->step - b->step; Дефиниция на структурата: struct zapis { float step,step1; float koef,koef1; zapis *next,*last;}; typedef zapis* po; po first=NULL,last=NULL,first1=NULL,last1=NULL,first2=NULL,last2=NULL,p,p1,p2; Функцията за сортиране: float cmp(zapis *a, zapis *b) { return a->step - b->step; } zapis *listsort(zapis *first) { zapis *p, *q, *e, *last; int insize, nmerges, psize, qsize, i;
if (!first) return NULL;
insize = 1;
while (1) {
nmerges = 0;
while (p) { nmerges++; q = p; psize = 0; for (i = 0; i < insize; i++) { psize++; q = q->next; if (!q) break; } qsize = insize; while (psize > 0 || (qsize > 0 && q)) { if (psize == 0) { e = q; q = q->next; qsize--; } else if (qsize == 0 || !q) { e = p; p = p->next; psize--; } else if (cmp(p,q) <= 0) { e = p; p = p->next; psize--; } else { e = q; q = q->next; qsize--; }
if (last) { last->next = e; } else { first = e; } last = e; } p = q; } last->next = NULL; if (nmerges <= 1) return first; insize *= 2; } }
Казано с други думи: опитвам се да пригодя mergesort за структурата ми, но безуспешно. Бихте ли помогнали?
|
|
|
3
|
Програмиране / Общ форум / Re: Помощ за задача на C++
|
-: May 10, 2010, 00:57
|
Ами част от нея е направена: #include <iostream.h> #include <stdio.h> #include <string.h> struct avtokushta { char marka [20]; float nomer; float cena; int godina; char cvqt[10]; int kilometri; char gorivo[10]; } void readProd(avtokushta*pr) { printf("Marka: "); gets(pr->marka); printf("Cena: "); scanf("%f", &pr->nomer); printf("Cena: "); scanf("%f", &pr->cena); printf("Gorivo: "); gets(pr->gorivo); printf("Godina: ");scanf("%f", &pr->godina); getchar(); printf("Kilometri: ");scanf("%f", &pr->kilometri); getchar(); printf("Cvqt: "); gets(pr->cvqt); } void main () { avtokushta avt[30] int n,i; float danni=0 }
|
|
|
5
|
Програмиране / Общ форум / Помощ за задача на C++
|
-: May 09, 2010, 23:13
|
Здравейте..нужна ми е помощ за задача на C++: В таблица се съдържат данни за автокъща, които включват: (марка на колата; номер на колата; цена; година на производство; цвят; километри; вид гориво). Програмата по-долу да въвежда данните за колите, извежда данните на кола по зададено вид гориво. В програмата данните за колите са представени като масив от структури, т.е. всеки елемент от масива е структура, която съдържа данните за една кола.
|
|
|
10
|
Хумор, сатира и забава / Хумор / Избор на университет за КТТ
|
-: Dec 11, 2009, 22:32
|
Предстои ми кандидастване в университет и съм си избрал специалност КТТ(Компютърна техника и технологии). Двоумя се между два университета - техническия Русе(Ангел Кънчев) и техническия Варна. Проблемът е, че не мога да реша кой е по добрия - и единя и другия има предимства, а на мен ми е нужно само добра подготовка. Кой от двата ще ми предложите(може и други университети)?
П.П. А вие къде сте завършили?
|
|
|
12
|
Хумор, сатира и забава / Живота, вселената и някакви други глупости / Re: Ботнет атакува!!! :)
|
-: Oct 15, 2009, 17:37
|
Всъщност и аз имам проблеми.. root ssh:notty 220.225.217.183 Mon Oct 12 19:40 - 19:40 (00:00) globus ssh:notty 220.225.217.183 Mon Oct 12 19:40 - 19:40 (00:00) root ssh:notty host61-149-stati Mon Oct 12 18:52 - 18:52 (00:00) root ssh:notty 203.116.198.165 Mon Oct 12 13:04 - 13:04 (00:00) root ssh:notty 203.116.198.165 Mon Oct 12 13:04 - 13:04 (00:00) root ssh:notty 203.116.198.165 Mon Oct 12 13:04 - 13:04 (00:00) root ssh:notty 203.116.198.165 Mon Oct 12 13:04 - 13:04 (00:00) root ssh:notty 203.116.198.165 Mon Oct 12 13:04 - 13:04 (00:00) root ssh:notty 203.116.198.165 Mon Oct 12 13:04 - 13:04 (00:00) root ssh:notty 203.116.198.165 Mon Oct 12 13:04 - 13:04 (00:00) root ssh:notty 203.116.198.165 Mon Oct 12 13:04 - 13:04 (00:00) root ssh:notty 203.116.198.165 Mon Oct 12 13:04 - 13:04 (00:00) root ssh:notty 203.116.198.165 Mon Oct 12 13:04 - 13:04 (00:00) root ssh:notty 203.116.198.165 Mon Oct 12 13:04 - 13:04 (00:00) gopher ssh:notty 200.20.215.131 Mon Oct 12 10:31 - 10:31 (00:00) rpc ssh:notty 200.20.215.131 Mon Oct 12 10:31 - 10:31 (00:00) rpcuser ssh:notty 200.20.215.131 Mon Oct 12 10:31 - 10:31 (00:00) nfsnobod ssh:notty 200.20.215.131 Mon Oct 12 10:31 - 10:31 (00:00) mailnull ssh:notty 200.20.215.131 Mon Oct 12 10:31 - 10:31 (00:00) workshop ssh:notty 200.20.215.131 Mon Oct 12 10:31 - 10:31 (00:00) desktop ssh:notty 200.20.215.131 Mon Oct 12 10:31 - 10:31 (00:00) aptproxy ssh:notty 200.20.215.131 Mon Oct 12 10:31 - 10:31 (00:00) popa3d ssh:notty 200.20.215.131 Mon Oct 12 10:31 - 10:31 (00:00) divine ssh:notty 200.20.215.131 Mon Oct 12 10:31 - 10:31 (00:00) harrypot ssh:notty 200.20.215.131 Mon Oct 12 10:31 - 10:31 (00:00) radiomai ssh:notty 200.20.215.131 Mon Oct 12 10:31 - 10:31 (00:00) snort ssh:notty 200.20.215.131 Mon Oct 12 10:31 - 10:31 (00:00) james ssh:notty 200.20.215.131 Mon Oct 12 10:31 - 10:31 (00:00) dan ssh:notty 200.20.215.131 Mon Oct 12 10:31 - 10:31 (00:00) frank ssh:notty 200.20.215.131 Mon Oct 12 10:31 - 10:31 (00:00) zzz ssh:notty 200.20.215.131 Mon Oct 12 10:31 - 10:31 (00:00) sys ssh:notty 200.20.215.131 Mon Oct 12 10:31 - 10:31 (00:00) proxy ssh:notty 200.20.215.131 Mon Oct 12 10:31 - 10:31 (00:00) eleve ssh:notty 200.20.215.131 Mon Oct 12 10:31 - 10:31 (00:00) list ssh:notty 200.20.215.131 Mon Oct 12 10:31 - 10:31 (00:00) irc ssh:notty 200.20.215.131 Mon Oct 12 10:31 - 10:31 (00:00) jeff ssh:notty 200.20.215.131 Mon Oct 12 10:31 - 10:31 (00:00) gnats ssh:notty 200.20.215.131 Mon Oct 12 10:30 - 10:30 (00:00) identd ssh:notty 200.20.215.131 Mon Oct 12 10:30 - 10:30 (00:00) telnetd ssh:notty 200.20.215.131 Mon Oct 12 10:30 - 10:30 (00:00) eppc ssh:notty 200.20.215.131 Mon Oct 12 10:30 - 10:30 (00:00) qtss ssh:notty 200.20.215.131 Mon Oct 12 10:30 - 10:30 (00:00) cyrusima ssh:notty 200.20.215.131 Mon Oct 12 10:30 - 10:30 (00:00) mailman ssh:notty 200.20.215.131 Mon Oct 12 10:30 - 10:30 (00:00) appserve ssh:notty 200.20.215.131 Mon Oct 12 10:30 - 10:30 (00:00) clamav ssh:notty 200.20.215.131 Mon Oct 12 10:30 - 10:30 (00:00) amavisd ssh:notty 200.20.215.131 Mon Oct 12 10:30 - 10:30 (00:00) jabber ssh:notty 200.20.215.131 Mon Oct 12 10:30 - 10:30 (00:00) xgridcon ssh:notty 200.20.215.131 Mon Oct 12 10:30 - 10:30 (00:00) agent ssh:notty 200.20.215.131 Mon Oct 12 10:30 - 10:30 (00:00) xgridage ssh:notty 200.20.215.131 Mon Oct 12 10:30 - 10:30 (00:00) appowner ssh:notty 200.20.215.131 Mon Oct 12 10:30 - 10:30 (00:00) windowse ssh:notty 200.20.215.131 Mon Oct 12 10:30 - 10:30 (00:00) tokend ssh:notty 200.20.215.131 Mon Oct 12 10:30 - 10:30 (00:00) security ssh:notty 200.20.215.131 Mon Oct 12 10:30 - 10:30 (00:00) unknown ssh:notty 200.20.215.131 Mon Oct 12 10:30 - 10:30 (00:00) dean ssh:notty 200.20.215.131 Mon Oct 12 10:30 - 10:30 (00:00) smmsp ssh:notty 200.20.215.131 Mon Oct 12 10:30 - 10:30 (00:00) uucp ssh:notty 200.20.215.131 Mon Oct 12 10:30 - 10:30 (00:00) halt ssh:notty 200.20.215.131 Mon Oct 12 10:30 - 10:30 (00:00) shutdown ssh:notty 200.20.215.131 Mon Oct 12 10:30 - 10:30 (00:00) sync ssh:notty 200.20.215.131 Mon Oct 12 10:30 - 10:30 (00:00) lp ssh:notty 200.20.215.131 Mon Oct 12 10:30 - 10:30 (00:00) daemon ssh:notty 200.20.215.131 Mon Oct 12 10:29 - 10:29 (00:00) bin ssh:notty 200.20.215.131 Mon Oct 12 10:29 - 10:29 (00:00) admins ssh:notty 200.20.215.131 Mon Oct 12 10:29 - 10:29 (00:00) admins ssh:notty 200.20.215.131 Mon Oct 12 10:29 - 10:29 (00:00) users ssh:notty 200.20.215.131 Mon Oct 12 10:29 - 10:29 (00:00) sshd ssh:notty 200.20.215.131 Mon Oct 12 10:29 - 10:29 (00:00) sgi ssh:notty 200.20.215.131 Mon Oct 12 10:29 - 10:29 (00:00) operator ssh:notty 200.20.215.131 Mon Oct 12 10:29 - 10:29 (00:00) rpm ssh:notty 200.20.215.131 Mon Oct 12 10:29 - 10:29 (00:00) amanda ssh:notty 200.20.215.131 Mon Oct 12 10:29 - 10:29 (00:00) party ssh:notty 200.20.215.131 Mon Oct 12 10:29 - 10:29 (00:00) richard ssh:notty 200.20.215.131 Mon Oct 12 10:29 - 10:29 (00:00) robert ssh:notty 200.20.215.131 Mon Oct 12 10:29 - 10:29 (00:00) sara ssh:notty 200.20.215.131 Mon Oct 12 10:29 - 10:29 (00:00) search ssh:notty 200.20.215.131 Mon Oct 12 10:29 - 10:29 (00:00) ssh ssh:notty 200.20.215.131 Mon Oct 12 10:29 - 10:29 (00:00) steven ssh:notty 200.20.215.131 Mon Oct 12 10:29 - 10:29 (00:00) sunny ssh:notty 200.20.215.131 Mon Oct 12 10:29 - 10:29 (00:00) susan ssh:notty 200.20.215.131 Mon Oct 12 10:29 - 10:29 (00:00) webpop ssh:notty 200.20.215.131 Mon Oct 12 10:29 - 10:29 (00:00) ident ssh:notty 200.20.215.131 Mon Oct 12 10:29 - 10:29 (00:00) adm ssh:notty 200.20.215.131 Mon Oct 12 10:29 - 10:29 (00:00) mail ssh:notty 200.20.215.131 Mon Oct 12 10:29 - 10:29 (00:00) pgsql ssh:notty 200.20.215.131 Mon Oct 12 10:29 - 10:29 (00:00) games ssh:notty 200.20.215.131 Mon Oct 12 10:29 - 10:29 (00:00) angel ssh:notty 200.20.215.131 Mon Oct 12 10:29 - 10:29 (00:00) news ssh:notty 200.20.215.131 Mon Oct 12 10:28 - 10:28 (00:00) john ssh:notty 200.20.215.131 Mon Oct 12 10:28 - 10:28 (00:00) john ssh:notty 200.20.215.131 Mon Oct 12 10:28 - 10:28 (00:00) george ssh:notty 200.20.215.131 Mon Oct 12 10:28 - 10:28 (00:00) richard ssh:notty 200.20.215.131 Mon Oct 12 10:28 - 10:28 (00:00) stephen ssh:notty 200.20.215.131 Mon Oct 12 10:28 - 10:28 (00:00) adam ssh:notty 200.20.215.131 Mon Oct 12 10:28 - 10:28 (00:00) wwwrun ssh:notty 200.20.215.131 Mon Oct 12 10:28 - 10:28 (00:00) www ssh:notty 200.20.215.131 Mon Oct 12 10:28 - 10:28 (00:00) web ssh:notty 200.20.215.131 Mon Oct 12 10:28 - 10:28 (00:00) sales ssh:notty 200.20.215.131 Mon Oct 12 10:28 - 10:28 (00:00) shop ssh:notty 200.20.215.131 Mon Oct 12 10:28 - 10:28 (00:00) info ssh:notty 200.20.215.131 Mon Oct 12 10:28 - 10:28 (00:00) backup ssh:notty 200.20.215.131 Mon Oct 12 10:28 - 10:28 (00:00) root ssh:notty 200.20.215.131 Mon Oct 12 10:28 - 10:28 (00:00) nobody ssh:notty 200.20.215.131 Mon Oct 12 10:28 - 10:28 (00:00) pop ssh:notty 200.20.215.131 Mon Oct 12 10:28 - 10:28 (00:00) httpd ssh:notty 200.20.215.131 Mon Oct 12 10:28 - 10:28 (00:00) http ssh:notty 200.20.215.131 Mon Oct 12 10:28 - 10:28 (00:00) www-data ssh:notty 200.20.215.131 Mon Oct 12 10:28 - 10:28 (00:00) data ssh:notty 200.20.215.131 Mon Oct 12 10:28 - 10:28 (00:00) alan ssh:notty 200.20.215.131 Mon Oct 12 10:28 - 10:28 (00:00) mike ssh:notty 200.20.215.131 Mon Oct 12 10:28 - 10:28 (00:00) brett ssh:notty 200.20.215.131 Mon Oct 12 10:28 - 10:28 (00:00) alex ssh:notty 200.20.215.131 Mon Oct 12 10:28 - 10:28 (00:00) danny ssh:notty 200.20.215.131 Mon Oct 12 10:28 - 10:28 (00:00) root ssh:notty 200.20.215.131 Mon Oct 12 10:28 - 10:28 (00:00) root ssh:notty 200.20.215.131 Mon Oct 12 10:27 - 10:27 (00:00) root ssh:notty 200.20.215.131 Mon Oct 12 10:27 - 10:27 (00:00) test ssh:notty 200.20.215.131 Mon Oct 12 10:27 - 10:27 (00:00) admin ssh:notty 200.20.215.131 Mon Oct 12 10:27 - 10:27 (00:00) root ssh:notty 200.20.215.131 Mon Oct 12 10:27 - 10:27 (00:00) user ssh:notty 200.20.215.131 Mon Oct 12 10:27 - 10:27 (00:00) username ssh:notty 200.20.215.131 Mon Oct 12 10:27 - 10:27 (00:00) webmaste ssh:notty 200.20.215.131 Mon Oct 12 10:27 - 10:27 (00:00) test ssh:notty 200.20.215.131 Mon Oct 12 10:27 - 10:27 (00:00) test ssh:notty 200.20.215.131 Mon Oct 12 10:27 - 10:27 (00:00) root ssh:notty 200.20.215.131 Mon Oct 12 10:27 - 10:27 (00:00) root ssh:notty 200.20.215.131 Mon Oct 12 10:27 - 10:27 (00:00) admin ssh:notty 200.20.215.131 Mon Oct 12 10:27 - 10:27 (00:00) admin ssh:notty 200.20.215.131 Mon Oct 12 10:27 - 10:27 (00:00) admin ssh:notty 200.20.215.131 Mon Oct 12 10:27 - 10:27 (00:00) admin ssh:notty 200.20.215.131 Mon Oct 12 10:27 - 10:27 (00:00) root ssh:notty 200.20.215.131 Mon Oct 12 10:27 - 10:27 (00:00) root ssh:notty 200.20.215.131 Mon Oct 12 10:27 - 10:27 (00:00) root ssh:notty 200.20.215.131 Mon Oct 12 10:27 - 10:27 (00:00) root ssh:notty 200.20.215.131 Mon Oct 12 10:27 - 10:27 (00:00) root ssh:notty 200.20.215.131 Mon Oct 12 10:27 - 10:27 (00:00) master ssh:notty 200.20.215.131 Mon Oct 12 10:27 - 10:27 (00:00) guest ssh:notty 200.20.215.131 Mon Oct 12 10:27 - 10:27 (00:00) admin ssh:notty 200.20.215.131 Mon Oct 12 10:27 - 10:27 (00:00) root ssh:notty 200.20.215.131 Mon Oct 12 10:27 - 10:27 (00:00) root ssh:notty 200.20.215.131 Mon Oct 12 10:27 - 10:27 (00:00) test ssh:notty 200.20.215.131 Mon Oct 12 10:26 - 10:26 (00:00) library ssh:notty 200.20.215.131 Mon Oct 12 10:26 - 10:26 (00:00) administ ssh:notty 200.20.215.131 Mon Oct 12 10:26 - 10:26 (00:00) username ssh:notty 200.20.215.131 Mon Oct 12 10:26 - 10:26 (00:00) ftpuser ssh:notty 200.20.215.131 Mon Oct 12 10:26 - 10:26 (00:00) visitor ssh:notty 200.20.215.131 Mon Oct 12 10:26 - 10:26 (00:00) named ssh:notty 200.20.215.131 Mon Oct 12 10:26 - 10:26 (00:00) newslett ssh:notty 200.20.215.131 Mon Oct 12 10:26 - 10:26 (00:00) core ssh:notty 200.20.215.131 Mon Oct 12 10:26 - 10:26 (00:00) tony ssh:notty 200.20.215.131 Mon Oct 12 10:26 - 10:26 (00:00) info ssh:notty 200.20.215.131 Mon Oct 12 10:26 - 10:26 (00:00) mysql ssh:notty 200.20.215.131 Mon Oct 12 10:26 - 10:26 (00:00) pgsql ssh:notty 200.20.215.131 Mon Oct 12 10:26 - 10:26 (00:00) apache ssh:notty 200.20.215.131 Mon Oct 12 10:26 - 10:26 (00:00) web ssh:notty 200.20.215.131 Mon Oct 12 10:26 - 10:26 (00:00) david ssh:notty 200.20.215.131 Mon Oct 12 10:26 - 10:26 (00:00) user ssh:notty 200.20.215.131 Mon Oct 12 10:26 - 10:26 (00:00) linux ssh:notty 200.20.215.131 Mon Oct 12 10:26 - 10:26 (00:00) admin ssh:notty 200.20.215.131 Mon Oct 12 10:26 - 10:26 (00:00) guest ssh:notty 200.20.215.131 Mon Oct 12 10:26 - 10:26 (00:00) root ssh:notty 200.20.215.131 Mon Oct 12 10:26 - 10:26 (00:00) paul ssh:notty 200.20.215.131 Mon Oct 12 10:26 - 10:26 (00:00) postgres ssh:notty 200.20.215.131 Mon Oct 12 10:26 - 10:26 (00:00) postfix ssh:notty 200.20.215.131 Mon Oct 12 10:26 - 10:26 (00:00) postmast ssh:notty 200.20.215.131 Mon Oct 12 10:26 - 10:26 (00:00) webmaste ssh:notty 200.20.215.131 Mon Oct 12 10:25 - 10:25 (00:00) test ssh:notty 200.20.215.131 Mon Oct 12 10:25 - 10:25 (00:00) ftp ssh:notty 200.20.215.131 Mon Oct 12 10:25 - 10:25 (00:00) michael ssh:notty 200.20.215.131 Mon Oct 12 10:25 - 10:25 (00:00) oracle ssh:notty 200.20.215.131 Mon Oct 12 10:25 - 10:25 (00:00) cyrus ssh:notty 200.20.215.131 Mon Oct 12 10:25 - 10:25 (00:00) virus ssh:notty 200.20.215.131 Mon Oct 12 10:25 - 10:25 (00:00) spam ssh:notty 200.20.215.131 Mon Oct 12 10:25 - 10:25 (00:00) webadmin ssh:notty 200.20.215.131 Mon Oct 12 10:25 - 10:25 (00:00) tomcat ssh:notty 200.20.215.131 Mon Oct 12 10:25 - 10:25 (00:00) samba ssh:notty 200.20.215.131 Mon Oct 12 10:25 - 10:25 (00:00) office ssh:notty 200.20.215.131 Mon Oct 12 10:25 - 10:25 (00:00) alias ssh:notty 200.20.215.131 Mon Oct 12 10:25 - 10:25 (00:00)
Представа си нямам к'во иска въпросният тип
|
|
|
|