![]() |
|
#21
|
|||
|
|||
Re: Deleting elements of arrays C++Quote:
CPP / C++ / C Code:
|
|||
|
#22
|
|||
|
|||
Re: Deleting elements of arrays C++i am posting this code if any body can find a faster way for the complier to execute the extract function please let me know i am not that experienced with c++
CPP / C++ / C Code:
|
|
#23
|
|||
|
|||
Re: Deleting elements of arrays C++Alright.....ugh.
I have a similar problem, but with a (seemingly) complicated twist.... 1. Instead of reading data in via a file, its being inputted by the user. 2. Not only does it remove the dupicates, it needs to keep a count of how many duplicates there were for that individual number. for example: If i put in 3 4 5 6 2 3 3 3 6 it would output N Count 2 1 3 4 4 1 5 1 6 2 My first problem that I've run into is for some reason (i'm a little whelmed at this point) is I can't figure out how to get the count, or display only the reduced number of values in the first array. Its my first experience with arrays and this is crazy. CPP / C++ / C Code:
|
|
#24
|
|||
|
|||
Re: Deleting elements of arrays C++hi, i got ur message i want to know if u r familiar with pointer and dynamic array (pointers will make it a lot easy and u can resize the array at any given time i may simplify the process) so this is what i have in mid create a function to take the user input
function initialise the array() function to detect the duplicate input and then it must resize the array when arr[i+1]=arr[i] . incrment the counter if u need more help with pointers and dynamic arrays let me know so i can post it and i am in the middle of my final week in school so if u are in a hurry let me know before what day u need it. if u r not familiar with pointer and dynamic array i will suggest that u leave that alone for now till u learn about them in school and if u r not in school study those first cuz dynamic array is what making the process of resizing array possible during run time. |
|
#25
|
|||
|
|||
Re: Deleting elements of arrays C++Nope I'm not familiar with pointer and dynamic arrays and we don't cover that for another few weeks
|
|
#26
|
|||
|
|||
Re: Deleting elements of arrays C++Quote:
Let me attempt to correct your misperception again as I may not have been clear enough. Using the following as an example: CPP / C++ / C Code:
CPP / C++ / C Code:
If the same array is allocated dynamically on the heap: CPP / C++ / C Code:
The difference between declaring variables on the stack & the heap are:
|
Recent GIDBlog
Programming ebook direct download available by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| need help with passing 3 arrays into a function | tommy69 | C Programming Language | 14 | 07-Apr-2004 01:22 |
| Problem multiplying arrays | hellhammer | C Programming Language | 9 | 29-Mar-2004 16:32 |
| Arrays | Chazza | C++ Forum | 10 | 23-Jan-2004 22:19 |
| pointers and arrays | jack | C Programming Language | 4 | 15-Jan-2004 13:27 |
| arrays in c | wolfgangaz | C Programming Language | 1 | 26-Oct-2003 05:52 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The