Cómañños' zookeeper» zookeeper
Ö÷ Ò ~äúè £° ° ¯ Ö öö ë
WHY» Why?
Int maxValue £m. int a £;int B.
{
Return a> B? A: B;
}
° ¯ Ê ý û *****************************************
Int maxValue £m. int a £;int B.
Int? * p? int?
° ¯ Ö öö ë ¨ £ Ç ±?» Ó Ð %%² %a £% B £
P = maxValue £°° Ö ö¸ µ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Int m = p £;3 £;5?
Áï ° £° ¨ â å á½ öö° ¯ £» ö öçó × '''A value of £;ò °» ö çó° í£ ******************************************************************* äè ë max» {sum · ö± Ç çó 3 ° í5 µä× î ''value» ******************************************* Ò å Ò» ö ö° ¯ ý Ö öö £ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%?
Int maxValue (int a, int B) // çó × ó ''; Value: µ° ¯ Ê ý
{
Return a> B? A: B;
}
Int sumValue (int a, int B) // çó°í µä° ¯ Ê ý
{
Return a + B;
}
Int main (int argc, const char * argv [])
{
Void (* p) (int, int) = NULL; // ¨ Ò» ö ööö ± äáá ¿
Int a, B; // you can specify the parameter å Á á½ ö~~~~ózä ¿
Printf "); // â ****» § **************************************
Scanf ("% d", & a, & B); // ± ê × µ µäè È ° ¯ ý
Printf
Char * name = malloc (sizeof (char) * 10 ); // É Ç çá ë char À Ð íµä³ Ë Ò Ô 10 µääú' then Õ Ä
Scanf ("% s", name );
// Please refer to Ï Ó óó» § Ê äè µ µäç çsum» Ç Ê max
If (strcmp (name, "sum") = 0 ){
P = sumValue;
} Else if (strcmp (name, "max") = 0 ){
P = maxValue;
} Else {
Printf ");
}
Free (name); // Í · Å äú' then £;;%%%%» ~%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%|
Int result = p (a, B); // you can specify the result as follows:
Printf ("% d", result); // ä äö ö½ á¹ û
}
¶ Þ ¡»?
° ¯ Ê öö ë × ×ö² Î ý
Int getValue (int a, int B, int (* p) (int, int ));
GetValue: ° ¯ Ê ý Ã û
Int (* p) (int, int): ° ¯ Ö ö¸ Õ × ×ögetvalue ° ¯ µ µä² Î ý
Int value = getValue (3, 5, maxValue ); £° ° getµ µ μ ÷ Ó £ £° getValue ° ¯ Ê Ö ö' Ð ¹ Ö? maxValue £.
Çíí ~~~~~£°
Áï ° £° Ð 'ú» ° ¯ Ê %%%%%%%****%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% çó û Ø μ ÷ ° ¯ Ú ° Ó ó Ó" target = "_ blank" class = "keylink"> vcD4KPHA + signature + cjxwpshould vcD4KPHA + signature/Signature + cHJpbnRmKA = "% s % d %. 2f ", (stu + I)-> name, (stu + I)-> age, (stu + I)-> score );
}
}
// É ù à ÷ ² ¢ ± à Ð ''' ² é Õ Ò 90 · öò É µ µän § éú² ¢ ú ú?ú à °? æ Ó ¡° ¸» Ë § ¡±
Void changeStudent (Student * stu, int count, void (* p) (Student *));
Void changeStudent (Student * stu, int count, void (* p) (Student *))
{
For (int I = 0; I <count; I ++ ){
If (stu + I)-> score> = 90 ){
P (stu + I );
}
}
}
Void changeName (Student * stu );
Void changeName (Student * stu)
{
Strcat (stu-> name, "getting started successfully» using §");
}
Int main (int argc, const char * argv []) {
Student student = {// ¨ å ¿
{"· Zookeeper ón", 26, 92 },
{"Áî ° ü ³ å", 30, 89 },
{"0000000000000000±0000", 27, 99} £m.
{"» Â *****", 20, 80} £.
{"Maid", 24, 80}
};
Int count = sizeof (student)/sizeof
PrintfStudent (stuent, count ); // '*****************************
ChangeStudent (student, count, changeName ); // please refer to the United Arab Emirates haven?
PrintfStudent (student, count) // '******************************
}
?
~~~~~~~%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%|
Void sortArray (int * array, int count)
{
For (int I = 0; I <count-1; I ++ ){
For (int j = 0; j <count-1-I; j ++ ){
If ){
Instances »»»
}
}
}
}
Mööööllo ~~~~~~~~~~~~~äâ ×° ~??~~~~ú '{»?
Int Comment comment **********************
Typedef BOOL (* PFUNC) (int, int); // Î ° ¯ Ö ö ~~~~~~~~~~~~~~~~~~
Void sortArray
Ê À ý £°
// 1 £° ''¨ Ò» ö ö½ á ¹ Ì å
Typedef struct {
Char name [20];
Int age;
Float score;
} Student;
// 3 £° 'Ó ópanion§ éúantá ¹ Ì å Ê × ×éµä° ¯ ý
Void printfStudent (Student * stu, int count );
Void printfStudent (Student * stu, int count)
{
For (int I = 0; I <count; I ++ ){
Printf ("% s % d %. 2f", (stu + I)-> name, (stu + I)-> age, (stu + I)-> score );
}
Printf ("\ n ");
}
// 5 £° 20.' then» ö ö° ¯ Ê ý ¸ Ó ó?
Void paiXuStudent (Student * stu, int count, BOOL (* PFUNC) (Student * stu1, Student * stu2 ));
Void paiXuStudent (Student * stu, int count, BOOL (* PFUNC) (Student * stu1, Student * stu2 ))
{
For (int I = 0; I <count-1; I ++ ){
For (int j = 0; j <count-1-I; j ++ ){
If (PFUNC (stu + j), (stu + j + 1 ))){
Student temp;
Temp = * (stu + j );
* (Stu + j) = * (stu + j + 1 );
* (Stu + j + 1) = temp;
}
}
}
}
// 6 £° ° ¨ Ò» ö ö° '· öê ý ±?' ó 'ó ¡µä° ¯ Ê ý
BOOL biJiaoScore (Student * stu1, Student * stu2 );
BOOL biJiaoScore (Student * stu1, Student * stu2)
{
Return stu1-> score> stuff-> score;
}
// ¨ Å Ò» ö ö° 'äá áäå Ð Ò µ µä° ¯ ý
BOOL compareAge (Student * stu1, Student * stu2 );
BOOL compareAge (Student * stu1, Student * stu2)
{
Return stu1-> age> stuff-> age
}
Int main (int argc, char * argv []) {
// 2 £° '½ %%%%%%%%%%%%%%%%%%%%%%%%%%%×
Student * student = {
{"Zookeeper", 22, 93 },
{"Zookeeper", 21, 97 },
{"Maid", 20, 80 },
{"Â · É", 19, 70}
};
// 4 £° Å Ç ç° μ ÷ Ó Ã 'ó Ó ° ¯ ''ó Ó áá ¹ Ì Å × é **************
Int count = sizeof (student)/sizeof (Student );
PrintfStudent (student, count );
// 7 £° µó Ó ° ¯ Ê ý
PaiXuStudent (student, count, biJiaoScore );
// PaiXuStudent (student, count, compareAge
// 8 £° 'Ó ó ¡Å ° Ó ó Ó?
PrintfStudent (student, count );
}