Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* ej49_Arrays
- Ejemplo de Arreglos asociativos */
- #include <radc++.h>
- Form form1("Arrays Asociativos - RAD C++ Ejemplo");
- Label label1("EMPLEADO BIO\n\n",-1,50,50,150,200,form1);
- SunkLine line1(210,50,2,200,form1);
- Label label2("EMPLEADO INFO\n\n",-1,250,50,100,200,form1);
- //create an associative array to hold string values
- createAssocArray(String, bio_data);
- //create an associative array to hold integers
- createAssocArray(int, extra_info);
- //NOTE: function createAssocArray accepts two arguments, where 1st is type of array elements,
- // and second is the name of variable.
- rad_main()
- //add some values to array of strings 'bio_data'
- bio_data["nombre"] = "Ali Imran";
- bio_data["titulo"] = "Programmer";
- bio_data["hobbies"] = "Programming";
- bio_data["NIC#"] = "PM-8500881";
- bio_data["ciudad"] = "Islamabad";
- bio_data["pais"] = "Pakistan";
- //add some values to array of integers 'exta_info'
- extra_info["edad"] = 30;
- extra_info["estatura"] = 6.1;
- extra_info["salario"] = 30000;
- extra_info["grado"] = 19;
- for(int i=0; i<bio_data.length; i++) {
- label1.caption = label1.caption + "\n" + bio_data.indexName(i) +"\t" + bio_data[i];
- }
- for(int i=0; i<extra_info.length; i++) {
- label2.caption = label2.caption + "\n" + extra_info.indexName(i) +"\t" + str(extra_info[i]);
- }
- //to accesss in field separately use
- //String test = bio_data["country"];
- //and for integer as we have in above example
- //int test = extra_info["salary"];
- rad_end()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement