| smemamian (3) | |
|
How can I have a class as follows: cin: student 1 : ID,Name,Last name,Address . . . . to student 10 : ID,Name,Last name,Address And have the ability to search(Based on ID And Last name). Tnx | |
|
|
|
| SirSen (17) | |||
use a data structure:
well, as for the ability to search i dont know yet | |||
|
Last edited on
|
|||
| Smac89 (201) | |||
use a for loop to search based on highest ID or based on highest ASCII code of the name. reading in the names as int will work for the ascii method
| |||
|
Last edited on
|
|||
| Darkmaster (494) | |
| he asked for a class, not a struct | |
|
|
|
| maeriden (341) | |
| Structs and classes are the same thing, except for the default access level | |
|
|
|
| Darkmaster (494) | |
| @ maeriden: hm, did some reading and you're right. and i was sooo sure it's not the same :D | |
|
|
|
| SirSen (17) | |||
here it is, but it has a problem in the lines 66-68 because i dont know why after that it loads and it stops, but i think u will understand the idea.
| |||
|
|
|||
| whitenite1 (751) | |||
|
@SirSen I believe your problem, line 66-68
is the for loop. It should read for(int c=0;c<a;c++)
| |||
|
|
|||
| SirSen (17) | |||
|
omg, how could i miss that =O thanks so much! Btw, check line 84, i forgot to tell the program to wait for an input to rerun the program;
| |||
|
Last edited on
|
|||
| whitenite1 (751) | |
|
@SirSen Well, I missed that!! In my defense, I wasn't really for anything other than the rows that contained the problem. Well, I guess I should look more carefully at code in the future. Thanks for pointing that one out to me. ;) Merry Christmas and a Joyous New Year.. | |
|
|
|
| SirSen (17) | |
| hahaha its ok. In fact, I didn't realize until i ran the program with ur correction, so thank you. Thanks and have a merry Christmas and a joyous New Year as well =) | |
|
Last edited on
|
|