panicos Δημοσ. 19 Φεβρουαρίου 2004 Δημοσ. 19 Φεβρουαρίου 2004 ME LIGA LOGIA Thelo enan Algorithmo pou tha olisthenei ta periexomena mias ouras apo thn arxi tis ouras opou briskontai ta stoixeia pros to telos tis. ME POLLA LOGIA Tha thela an kapios gnorizei kai mporei na boithisi na mou dosei ena algorithmo o opoios na olisthenei(shifting) ta stoixeia ta opoia briskontai se mia oura se morfi (pinaka). Siggekrimena thelo na olisthenei ta stoixeia pou briskontai stin arxi tis ouras kai na na ta topothetei sto telos tis ouras. O logos pou xreiazetai auti i olisthisi einai giati me sinexeis eisagoges kai exagoges stoixeion stin oura o deiktis telous ths ouras mporei na ginei isos me to megethos tou pinaka.Eno den tha eprepe afou mporei na yparxoun kenes theseis ston pinaka. etsi prepei na ginei olisthisi pros tous mikroterous deiktes etsi oste na mporesoume na ekmetaletoume to diathesimo xoro tou pinaka..
Mihos Δημοσ. 19 Φεβρουαρίου 2004 Δημοσ. 19 Φεβρουαρίου 2004 Prwta apolla pes mas se poia glwssa anaferese... Deuteron otan paizeis me oures & sthbes den anaferesai nomizw se arrays (pinakes) alla se pointers (toulaxiston aposo 8ymamai sth C. (opote de se apasxolei kai to mege8os tou "pinaka" opou les)
baxter Δημοσ. 19 Φεβρουαρίου 2004 Δημοσ. 19 Φεβρουαρίου 2004 file mihos, den einai anagastiko na paizeis mono me pointers se oures kai stoives... boreis kai me arrays.. file panicos, mallon s ehei piasei panicos giati den exigitai alliws. eipes oti thes na olisthainei ta stoiheia pou vriskodai stin arhi tis ouras kai na ta topothetei sto telos tis ouras... i oura einai to akrivws aditheto : kathe fora pou ehoume mia exagwgi (an ypothesoume oti hrisimopoioume pinakes) tote kaneis to exis aplo : (estwn pinakas n thesewn,pt o pointer pou deihnei poia thesi einai diathesimi sto telos) > for (x=2;x<=pt-1;x++) { oura[x-1]=oura[x]; } pt--; o pt tha deihnei pada stin prwti thesi tis ouras pou einai adeia ara kathe new eisagwgi tha tin kaneis sti thase oura[pt] kai sti sineheia tha kaneis ena pt++ ehodas ton pt tha einai efkolo na elegxeis pote eheis kenes theseis.
koyan Δημοσ. 20 Φεβρουαρίου 2004 Δημοσ. 20 Φεβρουαρίου 2004 file panicos: Einai askisi pou sas evale o kathigitis tou sxoleiou? Se psevdoglossa i se algorithmo... ?
fga2003 Δημοσ. 21 Φεβρουαρίου 2004 Δημοσ. 21 Φεβρουαρίου 2004 File panike h parakatw subroutina einai o algorithmos pou zhthses kai einai grammenos se glwssa PASCAL. procedure shift(var rear,front:integer;var b:pin); var i,x:integer; begin if ((rear=10) and (front>1)) then begin x:=10-(front-1); for i:=1 to x do begin b:=b[front]; front:=front+1; end; end; for i:=x+1 to 10 do b:=0; front:=1; rear:=x; end;
Opaque Δημοσ. 22 Φεβρουαρίου 2004 Δημοσ. 22 Φεβρουαρίου 2004 File Baxter, O algrori8mos poy edwses parapanw, exei ena mikro la8aki (to lew entelws plhroforiaka, apla, gia na mhn ginei pareksghsh). Estw oti to x=2 kai kaneis oyra[1]=oyra[2]. Xrhsimopoiwntas ayto to for loop, ayksanwntas to x mexri na ftaseis sthn teleytaia kataxwrhsh, kaneis pragmati shifting, alla, xaneis oles tis times. Dhladh, an kaneis apla oyra[1]=oyra[2], tote antika8istas thn timh poy yphrxe hdh sthn oyra[2] me thn timh ths oyras[1]. Etsi, otan 8a proxwrhseis kai kaneis oyra[2]=oyra[3], tote sthn oyra[3] 8a mpei h kainoyriaa timh ths oyra[2], poy einai h oyra[1]. Etsi olos o pinakas soy 8a gemisei me aythn thn timh. Einai protimotero loipon, gia na kaneis to shifting, eite na exeis kai mia allh metabllhth wste na apo8hkeyseis proswrina thn timh poy kaneis shifting, eite na ksekinhseis to shifting toy pinaka apo to telos sthn arxh (poy kata thn gnwmh moy einai to kalytero). Filika opaque
baxter Δημοσ. 22 Φεβρουαρίου 2004 Δημοσ. 22 Φεβρουαρίου 2004 file opaque, o kwdikas pou edwsa den periehei lathos... twra to provlima pou les esy , oti kai kala olos o pinakas tha gemisei apo to idio stoiheio tha ginei stin periptwsi pou kanoume afto pou proteineis esy! dld na kaneis to shifting apo to telos tou pinaka pros tin arhi.. Einai protimotero loipon, gia na kaneis to shifting, eite na exeis kai mia allh metabllhth wste na apo8hkeyseis proswrina thn timh poy kaneis shifting, eite na ksekinhseis to shifting toy pinaka apo to telos sthn arxh (poy kata thn gnwmh moy einai to kalytero). episis filika
Opaque Δημοσ. 23 Φεβρουαρίου 2004 Δημοσ. 23 Φεβρουαρίου 2004 Xmmm, loipon... panicos wrote : Thelo enan Algorithmo pou tha olisthenei ta periexomena mias ouras apo thn arxi tis ouras opou briskontai ta stoixeia pros to telos tis. baxter wrote : Κώδικας: for (x=2;x<=pt-1;x++) { oura[x-1]=oura[x]; } pt--; Ayto poy katalabainw egw oti zhtaw o panicos, einai oti an exoyme ton pinaka [2 4 3 6 1] kai eisagoyme to stoixeio 8, o pinakas 8a ginei : [8 2 4 3 6 1]. Ayto poy proteina egw htan : An o pt deixnei sthn prwth kenh 8esh toy pinaka, tote : for(x=pt;x>0;x--) { array[x]=array[x-1]; } array[0]=kanoyria_timh; pt++; Estw oti exoyme ton parapanw pinaka array=[2 4 3 6 1], o pt=5 (ypopsin oti to prwto stoixeio twn pinakwn einai to array[0]), kai 8eloyme na baloyme thn timh 8 ston pinaka. Tote loipon, ta bhmata toy algori8moy 8a einai : x=5-> array[5]=array[4] (array[5]=1) x=4-> array[4]=array[3] (array[4]=6) .... x=1-> array[1]=array[0] (array[1]=2) array[0]=kainoyria_timh ( array[0]=8 ) pt++; (pt=6) Opws blepeis, den dhmioyrgeitai kanena problhma, ektos bebaia an den katalaba kala ti zhtoyse o panicos, opote sorry. Filika opaque
baxter Δημοσ. 23 Φεβρουαρίου 2004 Δημοσ. 23 Φεβρουαρίου 2004 opague, o dikos sou kwdikas twra katalava oti einai gia eisagwgi.. to kommati pou egrapsa einai gia exagwgi.. opote eimaste ok
Προτεινόμενες αναρτήσεις
Αρχειοθετημένο
Αυτό το θέμα έχει αρχειοθετηθεί και είναι κλειστό για περαιτέρω απαντήσεις.