// file: lecture_10/example_00.cc // // a simple function that doesn't do much // // system include files // #include "example.h" // function: my_function // // arguments: // long arg1: the first argument // long arg2: the second argument // // return: a bool indicating status // bool my_function(long argv1, long argv2) { // do some bnit-level stuff // /* unsigned char a = 5, b = 9; // a = 5(00000101), b = 9(00001001) printf("a = %d, b = %d\n", a, b); printf("a&b = %d\n", a&b); // The result is 00000001 printf("a|b = %d\n", a|b); // The result is 00001101 printf("a^b = %d\n", a^b); // The result is 00001100 printf("~a = %d\n", a = ~a); // The result is 11111010 printf("b<<1 = %d\n", b<<1); // The result is 00010010 printf("b>>1 = %d\n", b>>1); // The result is 00000100 */ // exit gracefully // return true; } // function: poly // // arguments: // float a: ... // float b: ... // float c: ... // // return: a float containing the result // float poly(float a, float b, float c, float x) { return a*x*x + sin(b*x) + cos(c); }