Note that there are some explanatory texts on larger screens.

plurals
  1. POAda 05 question: Search specific elements in a vector of records?
    primarykey
    data
    text
    <p>I've created a Ada program that will be compiled in GNAT Gcc compiler 4.3.0 I created a record that consists of a name, phone, address and a birthday. The name, phone and address will be in unbounded string format and the birthday another record. The purpose here is to make a addressbook management system.(Very simple one)</p> <pre><code>type birthday is record year : Positive; month : Positive; day : positive; end record; type contact_type is record name : unbounded_string; phone : unbounded_string; address : unbounded_string; bday : birthday; end record; </code></pre> <p>I've already made an insert(using the append) and delete, and list function. I need a search and sort function to finish off.</p> <p>The thing is I made this record(the contact_type record) into a vector. Now I want to search from the vector for one of the elements/subclass(whatever you call it properly).</p> <p>For example search for a name... Or an address, etc. But using the vector's find_index method, I need to insert another record of the type contact_type and only an exactly same element will be returned as the result.</p> <p>But what I want is if I search a name, all the elements with the name is returned...</p> <p>And will it be possible to "Generic Sort" the vector in terms of Name, Address, Bday(So i have three different sorting options)</p> <p>PS. The first Ada program I'm writing is an addressbook manager... I'm a complete newbie, and I only have experience in C, and Java so it's kinda going rough... (It took me a long time finding out how to Standard input and Output lol)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload