2007年11月27日星期二

argh~!

zzz ... my english deproved like hell ... dropped from A to B+ .. T.T

Added on 2007/3/9:
Got back my report results a few months ago. The instructor gave an A- (80+/100) and a few comments along side. "Not enough explaination in some parts" ... Hey mdm, I've written 6,000+ words and the limit was only 3k, and not enough explaination? what the heck man ... Another comment wrote "grammer mistakes at later parts" ... COME ON, I did 90% of this crap by myself and its a mirical that I am able to turn in the piece of work in time and yet you condamn my .... argh, unreasonable hag.

2007年11月18日星期日

uni applications

haizzz... applying for other unis now ... cant take elec eng T.T.. wonder what should i put this time? (NOT EE OF CUZ!)

2007年11月16日星期五

Pon sch tomorrow~

Gonna pon the first period tomorrow, XD. Gotta rush report now T.T

2007年11月15日星期四

English technical communications

Wa ha ha ha~ Got back an assignment today. "Project Description". Got the highest in class XD... and why? Cause I am the only person who wrote 1600+ words when the page limit is set to two. XD. Anyway, the project is about chemical processes which produces electricity, but the main point is ... its about my favourite subject~ chemistry~! So, naturally there are a lot to be said, right? Anyway, on the assignment, I've set the font to size 8, and extend the writing till there are no spaces left on each side of the assignment. Oh and the comments which our teacher gave us is hilarious~!

*Good, very detailed description.
*Very knowledgeable
*Sorry, I can't give you detailed comments because it's very hard to read your small font. (And I wonder ... which idiot ask us to write no more than 2 pages ...)
*Besides, no space for me to write comments. (but arnt these your comments?)

=D

2007年11月14日星期三

At last ... Done with the stupid C++~!!!!!!

After a few hours of fierce battle with the language of C++ and my mental constrains, I've finally completed the crappy C++ assignment~~~ yay~~~ changed all the names of the stupid variables so that they wont shoot me for plagerism ... And ... seriously ... NEVER LET PEOPLE KNOW WHAT YOU HAVE DONE~!!!! but being labelled as "source provider" arnt that bad, huh? Feels kinda like "C++ hero saves the day~" (and C++ hero get caught for plagerism!) ... lol xD ~*winks.

If you are ever good at something, don't show it~!

Wah! During today's school hour, I realised something, and that is if you are good at something, NEVER tell other people ... ... ... A week ago, I've gave a few of my friends my copy of C++ code. I don't know which nincompoop did it but somehow someone spread my C++ code and one of my closer friends tell me that my somehow my C++ code had became this assignment's "offical source" and i became the nameless "offical source spreader" .... WHAT THE #$%@!!!!!!!! Oh well, kinda cool, issn't it? But ... omg .... which simpleton spread my code!!! Now I'll have to redo everything so as to escape from plagerism .... what a hilarious joke ... and whoever the idiot is, please ... tell me so that I can give him a piece of my mind ... zzz!


By the way, here is the code, for those of you who would like to witness something that was called the universal source:

#include #include #include
using namespace std;
class hex_op {
private: int value_x, value_z , value_add, value_temp_add, count_add, count_temp_add,value_determine_add, value_minus, value_temp_minus, count_minus, count_temp_minus,value_determine_minus, value_times, value_temp_times, count_times, count_temp_times,value_determine_times, value_divide, value_temp_divide, count_divide, count_temp_divide,value_determine_divide ; string temp_add[10], temp_minus[10], temp_times[10], temp_divide[10]; string store_add, store_minus, store_times, store_divide;

public:
hex_op () {}void calculate (string x, string z){ value_x =0; value_z =0; value_divide = value_add = value_minus = value_times =0; count_divide = count_add = count_minus = count_times =0; value_temp_divide = value_temp_times = value_temp_add = value_temp_minus =0; count_temp_divide = count_temp_times = count_temp_add = count_temp_minus =0; value_determine_divide =value_determine_add =value_determine_minus = value_determine_times =0;
for (int i = (x.length ()), j = 0; i >=0; i--) { if (x[i] >= 'a' && x[i] <= 'f') {value_x += ((((int)x[i]) - 87) * (int)pow(16.0,(double)j)); j++;} else if (x[i] >= '0' && x[i] <= '9') {value_x += ((((int)x[i]) - 48) * (int)pow(16.0,(double)j)); j++;} else continue; } for (int i = (z.length ()), j = 0; i >=0; i--) { if (z[i] >= 'a' && z[i] <= 'f') {value_z += ((((int)z[i]) - 87) * (int)pow(16.0,(double)j)); j++;} else if (z[i] >= '0' && z[i] <= '9') {value_z += ((((int)z[i]) - 48) * (int)pow(16.0,(double)j)); j++;} else continue; } if (x[0] == '-') (value_x = (value_x * -1)); if (z[0] == '-') (value_z = (value_z * -1));

value_add = (value_x + value_z);
value_temp_add = value_add;value_determine_add = value_add;

for ( ; ; ){if ((((value_temp_add % 16) >= 0)&& (value_temp_add > 0)) (((value_temp_add % 16) <= 0) && (value_temp_add < 0) )) { count_add ++; value_temp_add = (value_temp_add / 16); } else break;} count_temp_add = count_add;

count_add --; if (value_add < 0 ) {temp_add[0] = '-'; value_add = value_add * -1;}
for ( count_add; count_add >= 0; count_add --) {
if((value_add%16) > 9) temp_add[count_add] += ((char)((value_add % 16) + 87)); else temp_add[count_add] += ((char)((value_add%16) + 48)); (value_add = (value_add / 16)); } store_add.erase (); for (int i = 0; i <= count_temp_add; i++) store_add += temp_add[i]; for (int i = 0; i <= count_temp_add; i++) temp_add[i].erase();


value_minus = (value_x - value_z);
value_temp_minus = value_minus;value_determine_minus = value_minus;

for ( ; ; ){if((((value_temp_minus % 16) >= 0)&& (value_temp_minus > 0)) (((value_temp_minus % 16) <= 0) && (value_temp_minus < 0) )) { count_minus ++; value_temp_minus = (value_temp_minus / 16); } else break;} count_temp_minus = count_minus;

count_minus --; if (value_minus < 0 ) {temp_minus[0] = '-'; value_minus = value_minus * -1;}
for ( count_minus; count_minus >= 0; count_minus --) {
if((value_minus%16) > 9) temp_minus[count_minus] += ((char)((value_minus%16) + 87)); else temp_minus[count_minus] += ((char)((value_minus%16) + 48)); (value_minus = (value_minus / 16)); } store_minus.erase (); for (int i = 0; i <= count_temp_minus; i++) store_minus += temp_minus[i]; for (int i = 0; i <= count_temp_minus; i++) temp_minus[i].erase();
value_times = (value_x * value_z);
value_temp_times = value_times;value_determine_times = value_times;

for ( ; ; ){if((((value_temp_times % 16) >= 0)&& (value_temp_times > 0)) (((value_temp_times % 16) <= 0) && (value_temp_times < 0) )) { count_times ++; value_temp_times = (value_temp_times / 16); } else break;} count_temp_times = count_times;

count_times --; if (value_times < 0 ) {temp_times[0] = '-'; value_times = value_times * -1;}
for ( count_times; count_times >= 0; count_times --) {
if((value_times%16) > 9) temp_times[count_times] += ((char)((value_times%16) + 87)); else temp_times[count_times] += ((char)((value_times%16) + 48)); (value_times = (value_times / 16)); } store_times.erase (); for (int i = 0; i <= count_temp_times; i++) store_times += temp_times[i]; for (int i = 0; i <= count_temp_times; i++) temp_times[i].erase();
if (value_z != 0)
{value_divide = (value_x / value_z);


value_temp_divide = value_divide;value_determine_divide = value_divide;

for ( ; ; ){if ((((value_temp_divide % 16) >= 0)&& (value_temp_divide > 0)) (((value_temp_divide % 16) <= 0) && (value_temp_divide < 0) )) { count_divide ++; value_temp_divide = (value_temp_divide / 16); } else break;} count_temp_divide = count_divide;
count_divide --;if (value_divide < 0 ) {temp_divide[0] = '-'; value_divide = value_divide * -1;}
for ( count_divide; count_divide >= 0; count_divide --) {
if((value_divide%16) > 9) temp_divide[count_divide] += ((char)((value_divide%16) + 87)); else temp_divide[count_divide] += ((char)((value_divide%16) + 48)); (value_divide = (value_divide / 16)); } store_divide.erase (); for (int i = 0; i <= count_temp_divide; i++) store_divide += temp_divide[i]; for (int i = 0; i <= count_temp_divide; i++) temp_divide[i].erase(); }else{store_divide.erase ();for (int i = 0; i < 8; i ++)store_divide += '1';}
} string add () {return store_add;} string subtract () {return store_minus;} string multiply () {return store_times;} string divide () {return store_divide;} };
int main() { int n, op_n=0, hex_n=0; string input; string str; string tmp; string NaN_test; for ( ; ; ) {cout << "<< ";
getline(cin, str);
n = str.length ();
for(int j = 0; j < n; j ++){
if (str[j] == ' ') continue; else input += str[j];}
if ((input [0] == 'Q' input [0] == 'q') && (input [1] == 'U' input [1] == 'u') && (input [2] == 'I' input [2] == 'i') && (input [3] == 'T' input [3] == 't')) break;
//bonus
if (n == 0){cout << "Invalid expression" << endl;continue;}
if (input.length () == 0){cout << "Invalid expression" << endl;continue;}
bool invalid_test; string space_test; space_test.erase (); invalid_test = false; for(int i = 0; i <> '9') && (str[i] <'A' str[i] >'F') &&(str[i] < 'a' str[i] > 'f')&& (str[i] !='+' ) && (str[i] !='-' ) && (str[i] !='*' ) && (str[i] !='/' ) && (str [i] != ' ')) { invalid_test = true; break; }
else for (int i = 0, j = 0; i <>= '0' && space_test[j-1] <= '9') (space_test[j-1] >='A' && space_test[j-1] <='F') (space_test[j-1] >= 'a' && space_test[j-1] <= 'f'))&& ((space_test[j] >= '0' && space_test[j] <= '9') (space_test[j] >='A' && space_test[j] <='F') (space_test[j] >= 'a' && space_test[j] <= 'f')))))) { invalid_test = true; break; }
} if((input[(input.length ())-1] == '+')(input[(input.length ())-1] == '-') (input[(input.length())-1] == '*')(input[(input.length())-1] == '/')) { invalid_test = true; }
for (int i = 0; i < (input.length ()); i ++) { if((((input[i-1] == '+')(input[i-1] == '-') (input[i-1] == '*')(input[i-1] == '/')) && ((input[i] == '+') (input[i] == '*')(input[i] == '/'))) (((input[i-1] == '+')(input[i-1] == '-') (input[i-1] == '*')(input[i-1] == '/')) && (input[i+1] == '-') && ((input[i] == '+')(input[i] == '-') (input[i] == '*')(input[i] == '/')))) {invalid_test = true; break; } } if((input [0] == '+') (input[0] == '*') (input[0] == '/')) invalid_test = true; else if((input [0] == '-') && (input[1] == '-')) invalid_test = true; }


if (invalid_test == true){cout << "Invalid expression" << endl;str.erase();input.erase();continue;}
//bonus ends here
if((input[0] >='A' && input[0] <='F') && (input.length () == 1 ))input[0] = (char)((int)input[0] + 32);if ((input.length () == 1 )&& ((input[0] >= '0' && input[0] <= '9') (input[0] >= 'a' && input[0] <= 'f'))){ cout << input[0] << endl;input.erase ();str.erase ();continue;}
n = input.length (); string hex[n]; string op[n]; for (int i = 0; i <>='A' && input[i] <='F') input[i] = (char)((int)input[i] + 32); if ((input[i] >= '0' && input[i] <= '9') (input[i] >= 'a' && input[i] <= 'f')((input[i] == '-') &&(input [i-1] =='+' )(input [i-1] == '-' ) (input [i-1] == '*' )(input [i-1] == '/' )(i == 0)))
{hex[hex_n] += input[i]; } else if ((input [i] =='+' )(input [i] == '-' ) (input [i] == '*' )(input [i] == '/' )) { op[op_n] += input[i]; hex_n++; op_n++; } } for (int j = 0 ; j <= hex_n;j++) { if(j > 0) { cout <<> 0) {
hex_op cal; cal.calculate (hex[0], hex[1]); if (op[0][0] == '+') tmp = cal.add(); else if (op[0][0] == '-') tmp = cal.subtract(); else if (op[0][0] == '*') tmp = cal.multiply(); else if (op[0][0] == '/') tmp = cal.divide(); if ((hex[2].length ()) > 0) for (int i = 1; i <= (op_n-1); i++) { if (op[i-1][0] == '+') tmp = cal.add(); else if (op[i-1][0] == '-') tmp = cal.subtract(); else if (op[i-1][0] == '*') tmp = cal.multiply(); else if (op[i-1][0] == '/') tmp = cal.divide(); cal.calculate (tmp, hex[i+1]); if (op[i][0] == '+') tmp = cal.add(); else if (op[i][0] == '-') tmp = cal.subtract(); else if (op[i][0] == '*') tmp = cal.multiply(); else if (op[i][0] == '/') tmp = cal.divide(); } if((( tmp[0] != '-' )&&(tmp.length () > 6)) ((tmp[0] == '-' ) && (tmp.length () > 7))) { tmp.erase (); tmp += 'N'; tmp += 'a'; tmp += 'N'; } if (tmp.length() == 0) tmp = '0'; cout << tmp << endl; }
else { NaN_test.erase (); for( int i = 0; i < (hex[0].length ()); i ++ ) {
if (((hex[0][i] == '0')&&(NaN_test.length() == 0)) ((hex[0][i] == '0') &&(NaN_test.length()== 1)&&( NaN_test[0] =='-'))) continue; else NaN_test += hex[0][i]; } if((( NaN_test[0] != '-' )&&(NaN_test.length () > 6)) ((NaN_test[0] == '-' ) && (NaN_test.length () > 7))) cout << "NaN" << i =" hex_n;">=0 ; i --) hex[i].erase (); for ( int i = op_n; i >0 ; i --) op[i].erase (); str.erase(); input.erase (); tmp.erase (); hex_n = 0; op_n = 0; }
return 0;
}