Dsy Network www | forum | my | didattica | howto | wiki | el goog | stats | blog | dona | rappresentanti
Homepage
 Register   Calendar   Members  Faq   Search  Logout 
.dsy:it. : Powered by vBulletin version 2.3.1 .dsy:it. > Didattica > Corsi A - F > Algoritmi e strutture dati > [Progetto] L'ape bottinatrice
Pages (18): « First ... « 8 9 10 11 [12] 13 14 15 16 » ... Last »   Last Thread   Next Thread
Author
Thread    Expand all | Contract all    Post New Thread    Post A Reply
Collapse
allxxx
.illuminato.

User info:
Registered: May 2003
Posts: 188 (0.02 al dì)
Location: MILANO
Corso: INFORMATICA
Anno: 3
Time Online: 1 Day, 17:23:09: [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged
PROBLEMA estrazione int da file .txt

ciao non riesco ad estrarre dal file prato.txt i numeri in maniera corretta.
ho prato.txt e dentro ho dei numeri es.1 2 3 4 5 6 7 8 9
devo prendere questi numeri dal file e utilizzarli come int e non come char.
ho aperto il file con fopen() e poi dentro un while con fgetc() ho preso i numeri.
il problema è che come char me li vede ,ma come int mi restituisce il numero a cui i char appartengono.
es. 1 2 3 4 5 7 8 9 se li metto in un array int e li stampo come int vengono 49 50 51 52 53 54 55 56 57 e le operazioni di somma vengono fatte tra questi numeri.
ho provato anche a usare isdigit() ma mi viene fuori un numero-01632445
qualcuno sa dirmi il prima possibile come fare da un file a estrarre i numeri e utilizzarli come int?????

ciao allxxx

__________________
IL MIGLIOR TELEFILM TRA I MIGLIORI.... VOTA!!


29-09-2005 11:20
Click Here to See the Profile for allxxx Click here to Send allxxx a Private Message Find more posts by allxxx Add allxxx to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Frigging
.primate.

User info:
Registered: Mar 2005
Posts: 69 (0.01 al dì)
Location:
Corso: Informatica
Anno:
Time Online: 8:27:03: [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged
Re: PROBLEMA estrazione int da file .txt

Originally posted by allxxx
ciao non riesco ad estrarre dal file prato.txt i numeri in maniera corretta.
ho prato.txt e dentro ho dei numeri es.1 2 3 4 5 6 7 8 9
devo prendere questi numeri dal file e utilizzarli come int e non come char.
ho aperto il file con fopen() e poi dentro un while con fgetc() ho preso i numeri.
il problema è che come char me li vede ,ma come int mi restituisce il numero a cui i char appartengono.
es. 1 2 3 4 5 7 8 9 se li metto in un array int e li stampo come int vengono 49 50 51 52 53 54 55 56 57 e le operazioni di somma vengono fatte tra questi numeri.
ho provato anche a usare isdigit() ma mi viene fuori un numero-01632445
qualcuno sa dirmi il prima possibile come fare da un file a estrarre i numeri e utilizzarli come int?????

ciao allxxx


code:
int fscanf(FILE * restrict stream, const char * restrict format, ...);

29-09-2005 11:26
Click Here to See the Profile for Frigging Find more posts by Frigging Add Frigging to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
allxxx
.illuminato.

User info:
Registered: May 2003
Posts: 188 (0.02 al dì)
Location: MILANO
Corso: INFORMATICA
Anno: 3
Time Online: 1 Day, 17:23:09: [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

quindi apro con fopen e poi invece di fgetc utilizzo fscanf

__________________
IL MIGLIOR TELEFILM TRA I MIGLIORI.... VOTA!!


29-09-2005 11:29
Click Here to See the Profile for allxxx Click here to Send allxxx a Private Message Find more posts by allxxx Add allxxx to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
maynard80
.novellino.

User info:
Registered: Jul 2007
Posts: 3 (0.00 al dì)
Location: Milano (e non interland, tendo a precisare)
Corso: informatica
Anno: SESTO
Time Online: 12 Days, 14:28:38 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

bene, ora il problemone è l'algoritmo dei cammini, pensavo di calcolare ricorsivamente tutti i cammini possibili e restituire quello con la somma di nodi migliore....ma è tremendamente pesante...consigli? algoritmi noti usati?

__________________
msn Messenger: giamma80 at tiscali.it
ATHENA !

29-09-2005 11:36
Click Here to See the Profile for maynard80 Click here to Send maynard80 a Private Message Find more posts by maynard80 Add maynard80 to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
mitnik
.illuminato.

User info:
Registered: Jun 2002
Posts: 235 (0.03 al dì)
Location:
Corso:
Anno:
Time Online: 3 Days, 4:25:25 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

HO notato due cose:

se i numeri nel file dato in input alla funzione inserisci sono separati da un newline il programma non mi legge correttamente i numeri; se invece sono separati solo da apzi il tutto funziona. Nel testo dice che ..... nome deve essere un file contenente numeri interi separati da caratteri di spaziatura...
Voi che dite?

Altra cosa; se provo ad inserire il test di Frigging in linux il tutto è lento ma funziona, sotto windows (merdaccia di XP) non riesco nemmeno ad inserire in prato -1000 -1000 1000 1000, mi si blocca.
Il Prof che sistema usa per i test?

29-09-2005 15:54
Click Here to See the Profile for mitnik Click here to Send mitnik a Private Message Find more posts by mitnik Add mitnik to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Ziotony.f4f
.fedelissimo.

User info:
Registered: Dec 2002
Posts: 49 (0.01 al dì)
Location:
Corso:
Anno:
Time Online: 17:30:00: [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Fiorentini testa tutto con LINUX sicuramente, penso che non provi nemmeno con windows.
Qualcuno di voi ha già consegnato, visto che va tutto bene ? Io sarei tentato, anche perchè se c'è qualche problema ho il tempo nel weekend per tappare i buchi..altrimenti sarei nella cacca.

Per l'efficienza dell'algoritmo, il mio fa un po' schifo, l'unica cosa che spero è che non esageri con gli input massicci, praticamente è una potenza di 3. Di quelli che hanno testato l'input pesantissimo, 1000 1000 come avete ottimizzato il vostro sistema di calcolo del viaggio? l'avete ottenuto lineare!?!?

29-09-2005 17:13
Click Here to See the Profile for Ziotony.f4f Click here to Send Ziotony.f4f a Private Message Find more posts by Ziotony.f4f Add Ziotony.f4f to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
eskimo
.illuminato.

User info:
Registered: Jul 2003
Posts: 156 (0.02 al dì)
Location: Milano
Corso: informatica
Anno: 3datroppotempoormai
Time Online: 1 Day, 22:23:46 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

WOW!!! FUNZICAAAA!!!!
ma solo testando input del prof... con quello di frigging si incarta di brutto! al primo elimina -50 63 (o qualcosa cos') si incartaaa!

'zzo
che dite senza speranza?

29-09-2005 17:56
Click Here to See the Profile for eskimo Click here to Send eskimo a Private Message Find more posts by eskimo Add eskimo to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
mitnik
.illuminato.

User info:
Registered: Jun 2002
Posts: 235 (0.03 al dì)
Location:
Corso:
Anno:
Time Online: 3 Days, 4:25:25 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

ho mandato una mail ad aguzzoli e ha detto che se il problema è solo con input grossi di non preoccuparsi che non ne useranno! adesso gli ho chiesto quanto grossi! aspetto risposta ma penso che non vadano olte i prati di 100 x 100

29-09-2005 18:06
Click Here to See the Profile for mitnik Click here to Send mitnik a Private Message Find more posts by mitnik Add mitnik to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
eskimo
.illuminato.

User info:
Registered: Jul 2003
Posts: 156 (0.02 al dì)
Location: Milano
Corso: informatica
Anno: 3datroppotempoormai
Time Online: 1 Day, 22:23:46 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

ciao qualcuno avrebbe un test da postare che non sia gigante come quello di frigging??

30-09-2005 12:19
Click Here to See the Profile for eskimo Click here to Send eskimo a Private Message Find more posts by eskimo Add eskimo to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
mitnik
.illuminato.

User info:
Registered: Jun 2002
Posts: 235 (0.03 al dì)
Location:
Corso:
Anno:
Time Online: 3 Days, 4:25:25 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

ho trovato un errore! se scrivo il file.txt contenente i numeri ed ogni tanto durante l'inserimento premi invio per andare su una nuova riga, quando vado ad inserire un prato non mi trova i giusti valori dei fiori. Secondo voi come posso fare.

Altra cosa; compilo con l'opzione -ansi e mi da errori di questo tipo:

/tmp/ccTtKRfj.o(.text+0xef2): In function `elimina':
: multiple definition of `elimina'

Sapete da cosa dipende?

Grazie


Per il test prova a fare quello che ho postato ieri; magari fai un bel copia incolla in modo da fare ciclare il test parecchie volte; vedi come si comporta il programma.

30-09-2005 13:07
Click Here to See the Profile for mitnik Click here to Send mitnik a Private Message Find more posts by mitnik Add mitnik to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Ziotony.f4f
.fedelissimo.

User info:
Registered: Dec 2002
Posts: 49 (0.01 al dì)
Location:
Corso:
Anno:
Time Online: 17:30:00: [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Per me il test di Kevin Mitnik è OK, il mio prog. però non riesce proprio a supportare viaggi troppo lunghi , soffre di dolori muscolari , speriamo bene, io ho mandato il tutto via mail a Fiorentini , so già che troverà qualcosa che non va , me lo sento .... qualcuno ha ricevuto risposte ??

Buona fortuna a tutti

30-09-2005 15:30
Click Here to See the Profile for Ziotony.f4f Click here to Send Ziotony.f4f a Private Message Find more posts by Ziotony.f4f Add Ziotony.f4f to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
mitnik
.illuminato.

User info:
Registered: Jun 2002
Posts: 235 (0.03 al dì)
Location:
Corso:
Anno:
Time Online: 3 Days, 4:25:25 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

ho sistemato le ultime cose.

Il mio invece è allergico a windowsXP.

Vabbè non so se inviare tutto adesso oppure fare qualche altro test e mandare il progetto a Fiorentini lunedì!

A voi sotto windows funziona tutto correttamente?

30-09-2005 16:19
Click Here to See the Profile for mitnik Click here to Send mitnik a Private Message Find more posts by mitnik Add mitnik to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
maynard80
.novellino.

User info:
Registered: Jul 2007
Posts: 3 (0.00 al dì)
Location: Milano (e non interland, tendo a precisare)
Corso: informatica
Anno: SESTO
Time Online: 12 Days, 14:28:38 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

ragazzi scusate sono nel pallone, mi dite come cancellare gli elementi di una lista?

la liste è formata da nodi del tipo

struct nodo{
int x;
int y;
struct nodo *next;
}

voglio cancellare dalla lista tutti i nodi la cui x è n

nodo *cancellaSelezionati(*struct nodo head, int n);

storincoglionendo,pleaseee!

__________________
msn Messenger: giamma80 at tiscali.it
ATHENA !

30-09-2005 18:09
Click Here to See the Profile for maynard80 Click here to Send maynard80 a Private Message Find more posts by maynard80 Add maynard80 to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
zac111
.illuminato.

User info:
Registered: Jun 2004
Posts: 243 (0.03 al dì)
Location:
Corso:
Anno:
Time Online: 1 Day, 23:50:52 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

anche il mio è allergico a xp, la consegna è per lunedì entro
mezzanotte? e la relazione martedì?

01-10-2005 07:29
Click Here to See the Profile for zac111 Click here to Send zac111 a Private Message Find more posts by zac111 Add zac111 to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
mitnik
.illuminato.

User info:
Registered: Jun 2002
Posts: 235 (0.03 al dì)
Location:
Corso:
Anno:
Time Online: 3 Days, 4:25:25 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

si entro lunedì devi mandare il progetto e relazione. Il formato cartaceo lo puoi portare anche martedì.

Cosa ti succede con xp?

01-10-2005 09:01
Click Here to See the Profile for mitnik Click here to Send mitnik a Private Message Find more posts by mitnik Add mitnik to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
All times are GMT. The time now is 21:08.    Post New Thread    Post A Reply
Pages (18): « First ... « 8 9 10 11 [12] 13 14 15 16 » ... Last »   Last Thread   Next Thread
Show Printable Version | Email this Page | Subscribe to this Thread | Add to Bookmarks

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is ON
 

Powered by: vBulletin v2.3.1 - Copyright ©2000 - 2002, Jelsoft Enterprises Limited
Mantained by dsy crew (email) | Collabora con noi | Segnalaci un bug | Archive | Regolamento | Licenze | Thanks | Syndacate
Pagina generata in 0.066 seconds (72.16% PHP - 27.84% MySQL) con 24 query.