Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
condtions with struct!!
Name: computergirl Date: June 9, 2009 at 13:05:32 Pacific OS: Windows Vista Subcategory: C/C++
Comment:
hey can anyone help me ....i did astruct for 10 students and enterd theier names ,number,college,department,level....its easy but theproblem i faced after that is i want to categori each student who has the same college name be printd together so example students n computer they r all groupd together and if i enterd 2 students from bussiness they has to be groupd together ...how can i do??? i tried doing if(std[i].college=="computer") but it didnt work and tried also if(std[i].college==std[i],college) ofcourse these r inside aloop....so please help me fast>>>>>
Name: Zlatko Date: June 19, 2009 at 16:10:33 Pacific
Reply:
C/C++ does not work that way. You can compare std::string objects using ==, but not character arrays which is what I think you are doing. Do this if (strcmp(std[i].college, "computer") == 0) The strcmp function compares two C strings and returns 0 when they are equal.
0
Response Number 2
Name: shutat Date: June 23, 2009 at 03:10:49 Pacific
Reply:
If you aren't comparing strings, then you may be after sorting the struct by whatever property.
For example, sort the struct by college name and then try outputting the result.
Summary: I´ve created a dll using C and now I want to access the dll functions from my exe created in VB. I dont have problems with functions with simples parameters like int and double, but I dont know how t...
Summary: i need to call from my java program to c functions that get c structs as a parameters in their prototype. as you probablly know java is not working with structs (classes only), so my question is how...
Summary: You can use const in C. In C, main does not have to be an int routine: it can be void. In C++, a forward declaration of void fred(); means fred has no parameters. In C, it means you don't know what ...