473,395 Members | 1,516 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

[Programmazione oggetti] inserimento in testa in una lista

Spero di aver postato nel luogo giusto, avrei bisogno di un aiutito.
Come dal titolo mi sto avventurando per la prima volta nella
programmazione ad oggetti con il c++, ho usato per poco tempo e con
nozioni molto elementari il java.

Ecco il mio problema:
Ho una lista di tipo elementi, ora dovrei inserire in testa a questa
lista un nuovo elemento. ho fatto così:

L'elemento è costituito da:
un intero
due stringhe
un putatore di tipo elemento //utilizzato per puntare al
successivo

1- mi sono dichiarato un nuovo puntatore alla lista per esempio aux
2- ho copiato il puntatore al primo elemento della lista (primo) nel
puntatore appena inizializzato (aux)
3- creato il nuovo oggetti elemento, copio l'indirizzo dell'elemento
appena creato nel puntatore primo
4- assegno al puntatore successivo, prensente nell' oggetto next, il
valore di aux

Ora quando vado a fare la stampa della lista mi stampa sempre l'ultimo
elemento inserito!!!

Ho pensato allora di andare a fare l'overloading dell'uguale,ma prima
di avventurarmi in ore di programmazioni vorrei sapere se ho sbagliato
qualcosa o esiste un metodo più veloce per aggiungere in testa.

Poi vi chiedo anche se potete consigliarmi qualche sito da dove
prendere materiale (guide tutorial ecc) possibilmente in italiano.

Grazie in anticipo e buon lavoro

Feb 10 '06 #1
2 4188
On Fri, 10 Feb 2006 05:49:46 -0800, DiPo wrote:
Spero di aver postato nel luogo giusto, avrei bisogno di un aiutito. Come
dal titolo mi sto avventurando per la prima volta nella programmazione ad
oggetti con il c++, ho usato per poco tempo e con nozioni molto elementari
il java.

Hvad spørges der om her? jeg forstår ikke det sprog, spørgsmålet er
skrevet i:-\
Translation: What is the question here? I do not understand the language
in which the question is written:-\

Sorry, had to write a reply in danish:-)

--
Hilsen/Regards
Michael Rasmussen
http://keyserver.veridis.com:11371/p...rch=0xE3E80917

Feb 10 '06 #2
DiPo wrote:
Spero di aver postato nel luogo giusto, avrei bisogno di un aiutito.

[snip]

I think you want it.comp.lang.c++.

Cheers! --M

Feb 10 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Tony Johansson | last post by:
Hello! I have two classes called Handle which is a template class and a class Integer which is not a template class. The Integer class is just a wrapper class for a primitive int with some...
1
by: matic74 | last post by:
Salve a tutti, sto sviluppando un'applicazione web piuttosto complessa in java che utilizza il framework Bluprint della Sun. In particolare, la mia problematica è legata alla...
0
by: Fabrizio Cannatelli | last post by:
ciao a tutti vi espongo il mio problema allora io ho un db access su un server dove salvo dei dati utilizzando vb6 e le visualizzo con pagine asp..Il problema è questo dato che i dati da salvare...
18
by: cs | last post by:
This is the function malloc_m() that should be like malloc() but it should find memory leak, and over bound writing in arrays. How many errors do you see? Thank you...
0
by: Andrea J | last post by:
Salve a tutti! Sto usando una listBox come contenitore per una lista di oggetti che istanziano una classe che deriva da object. In pratica nella listBox metto direttamente sti oggetti, così...
0
by: Jarod_24 | last post by:
test sendt at 12:42 GMT+2
6
by: TC | last post by:
Hi. I write a program in c language that read a text file and extrapolate the word. for all word the program calculate the number of the times that word is present in the text. The problem is the...
52
by: ¬a\\/b | last post by:
is it possible that a malloc function that use a nobody student is better than all yours :) How many errors do you see? Bug1: memory<13MB Bug2: it seems do you have to write you own sprintf...
1
by: Napster | last post by:
Ciao, vorrei realizzare una connessione verso un sito che richiede di inserire un codice captha per la conferma. Come è possibile leggerlo via OCR e inserirlo automaticamente? Se non fosse...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.