Game Đua Thú Siêu Tốc

#include<string> #include <windows.h> #include<iostream> using namespace std; class dongvat { protected: int tocdochay; public: dongvat() { tocdochay = 0; } virtual int sosanhtocdochay(dongvat a) { //return tocdochay > a.tocdochay ? 1 : -1; return tocdochay > a.tocdochay ? 1 : (tocdochay < a.tocdochay ? -1 : 0); } ~dongvat() { return; } }; class bao :public dongvat { public: bao() { tocdochay = 100; } int sosanhtocdochay(bao a) { return tocdochay > a.tocdochay ? 1 : (tocdochay < a.tocdochay ? -1 : 0); } ~bao() { return; } }; class linhduong :public dongvat { public: linhduong() { tocdochay = 80; } int sosanhtocdochay(linhduong a) { return tocdochay > a.tocdochay ? 1 : (tocdochay < a.tocdochay ? -1 : 0); } ~linhduong() { return; } }; class sutu :public dongvat { public: sutu() { tocdochay = 70; } int sosanhtocdochay(sutu a) { return tocdochay > a.tocdochay ? 1 : (tocdochay < a.tocdochay ? -1 : 0); } ~sutu() { return; } }; class cho :public dongvat { public: cho() { tocdochay = 60; } int sosanhtocdochay(cho a) { return tocdochay > a.tocdochay ? 1 : (tocdochay < a.tocdochay ? -1 : 0); } ~cho() { return; } }; class nguoi :public dongvat { public: nguoi() { tocdochay = 30; } int sosanhtocdochay(nguoi a) { return tocdochay > a.tocdochay ? 1 : (tocdochay < a.tocdochay ? -1 : 0); } ~nguoi() { return; } }; class ngua :public dongvat { public: ngua() { tocdochay = 60; } int sosanhtocdochay(ngua a) { return tocdochay > a.tocdochay ? 1 : (tocdochay < a.tocdochay ? -1 : 0); } ~ngua() { return; } }; void sosanhtocdogiàconvat() { dongvat *a1 = NULL; dongvat *a2 = NULL; int chon, con1, con2; do { SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 5); cout << "\n. - -._. - -. - -._. - -. - -._. - -. - _______♥_¤♥ ... ♥¤ _______♥_¤♥ ... ♥¤ - -."; cout << "\n. ove.you! . - -._. - -. - -_______♥_¤♥ ... ♥¤ _______♥_¤♥ ... ♥¤ - -._. - -. - -._. - -."; cout << "\n ._. ._. - -._. - -. - -._. - -. - -._. - -. - -._. - -."; cout << "\n. - -._. - -. - - _______♥_¤♥ ... ♥¤ -._. - -. - -._. - -. - -._. - -. - -._. - -.."; cout << "\n. Love.you! - Love.you!-._. - Love.you!-..Love.you!Love.you!"; cout << "\n ._. ._. _. ._._. ._._. ._._. ._._. ._._. ._._. ._._. ._._. ._."; cout << "\n. - -._. - -. - -._______♥_¤♥ ... ♥¤ _______♥_¤♥ ... ♥¤ _______♥_¤♥ ... ♥¤ "; cout << "\n._______♥_¤♥ ... ♥¤ I.love.you!._______♥_¤♥ ... ♥¤ _______♥_¤♥ ... ♥¤ "; cout << "\n._. _______♥_¤♥ ... ♥¤ __ - -._. - -._. - -._.♥¤ ._. _______♥_¤♥ ... ♥¤ _______♥_¤♥ ... ♥¤ "; cout << "\n._ - -._. - -._. - -._. - -._. - -._. - -._. - -._. - -._. - -._. - -._. - -."; cout << "\n.I.love.You!_______♥_¤♥ ... ♥¤ ."; cout << "\n._. ._. _!"; /*cout << "\n_______♥_¤♥ ... ♥¤ _______♥_¤♥ ... ♥¤ _____"; cout << "\n_____¤♥ w♥ ¤___¤ ♥F♥ ¤__ _____¤♥ w♥ ¤___¤ ♥F♥ ¤_"; cout << "\n__¤♥ h♥ ¤__Một__¤♥♥♥ ¤ ♥ ___¤♥ h♥ ¤__Một__¤♥♥♥ ¤"; cout << "\n__¤♥ o♥ ¤____nửa ____¤♥ ♥ __¤♥ o♥ ¤____nửa ____¤♥"; cout << "\n__¤♥ a♥ ¤_____còn ____ ♥ __¤♥ a♥ ¤_____còn _____"; cout << "\n___¤♥ r♥¤ _____lại_____ ♥ ___¤♥ r♥¤ _____lại______"; cout << "\n____¤♥ e♥ ¤____đang ___ ____¤♥ e♥ ¤____đang ___"; cout << "\n______¤♥ y♥____ở _____ ___¤♥ y♥____ở _____"; cout << "\n________¤♥ o♥ ¤__đâu __ _____¤♥ o♥ ¤__bên __"; cout << "\n__________¤♥ u♥ ¤_ ? ? ? __ _____¤♥ u♥ ¤_ ? ? ? __"; cout << "\n____________¤♥ ? ♥¤ ____ _____¤♥ ? ♥¤ ____ngoài"; cout << "\n______________¤♥ ? ♥¤ __ ____¤♥ ? ♥¤ __này"; cout << "\n________________¤♥ _____ _¤♥ ___ ";*/ cout << "\n|------------------Game_Dua_Thu_Sieu_toc--------------------|"; cout << "\n|<--nhap so 2 con vat tuong ung trong menu de duyet toc do->|"; cout << "\n|1.------*-----#-----------b-a'-o---------------#---*-------|"; cout << "\n|2.------*-----#-----l-i-n-h---d-u-o-n-g--------#---*-------| *"; cout << "\n|3.------*-----#---------s-u---t-u--------------#---*-------|"; cout << "\n|4.------*-----#------------c-h-o'--------------#---*-------|"; cout << "\n|5.------*-----#----------n-g-u-o`-i------------#---*-------|"; cout << "\n|6.------*-----#-----------n-g-u.-a-------------#---*-------|"; cout << "\n|0.------*-----#-t-h-o-a-t'---t-r-o`---c-h-o-i--#---*-------|"; cout << "\n|<--by a POsgia.com---------------------------------------->|"; cout << "\n|**https://www.facebook.com/chuc.tiensinh*******************|"; cout << "\n|--------*-----#--------------------------------#---*-------|\n"; cout << "\n. - -._. - -. - -._. - -. - -._. - -. - _______♥_¤♥ ... ♥¤ _______♥_¤♥ ... ♥¤ - -."; cout << "\n. ove.you! . - -._. - -. - -_______♥_¤♥ ... ♥¤ _______♥_¤♥ ... ♥¤ - -._. - -. - -._. - -."; cout << "\n ._. ._. - -._. - -. - -._. - -. - -._. - -. - -._. - -."; cout << "\n. - -._. - -. - - _______♥_¤♥ ... ♥¤ -._. - -. - -._. - -. - -._. - -. - -._. - -.."; cout << "\n. Love.you! - Love.you!-._. - Love.you!-..Love.you!Love.you!"; cout << "\n ._. ._. _. ._._. ._._. ._._. ._._. ._._. ._._. ._._. ._._. ._."; do { //system("color 5d"); SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 14); cout << "\nchon con vat thu 1: "; cin >> con1; if (con1 == 0) { break; } if (con1 < 1 || con1>6) { cout << "\nco 6 con xin kiem tra lai"; } if (con1 == 1) { a1 = new bao; } else if (con1 == 2) { a1 = new linhduong; } else if (con1 == 3) { a1 = new sutu; } else if (con1 == 4) { a1 = new cho; } else if (con1 == 5) { a1 = new nguoi; } else if (con1 == 6) { a1 = new ngua; } } while (con1 < 1 || con1>6); ///////con th? 2 if (con1 == 0) { exit(0); } do { SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 14); cout << "\nchon con vat thu 2: "; cin >> con2; if (con1 != 0 && con2 == 0) { cout << "\nkhong co con thu 2 de so sanh xin kiem tra lai!..."; } else if (con1 == 0 && con2 == 0) { break; } if (con2 < 1 || con2>6) { cout << "\nco 6 con xin kiem tra lai"; } else if (con2 == 1) { a2 = new bao; } else if (con2 == 2) { a2 = new linhduong; } else if (con2 == 3) { a2 = new sutu; } else if (con2 == 4) { a2 = new cho; } else if (con2 == 5) { a2 = new nguoi; } else if (con2 == 6) { a2 = new ngua; } } while (con2 < 1 || con2>6); if (con1 == 0 && con2 == 0) { exit(0); } else { system("cls"); //system("color 8a"); int m = a1->sosanhtocdochay(*a2); if (m == 1) { SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 9); cout << "\<-nBAN---------------KET-------------QUA->"; SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 11); cout << "\n|----------------------------------|\n"; cout << "\n|Con thu 1 chay nhanh hon con thu 2|\n"; cout << "\n|----------------------------------|\n"; } else if (m == -1) { SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 9); cout << "\n<-BAN---------------KET-------------QUA->"; SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 4); cout << "\n|---------------------------------|\n"; cout << "\n|Con thu 1 chay cham hon con thu 2|\n"; cout << "\n|---------------------------------|\n"; } else { SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 9); cout << "\n<-BAN---------------KET-------------QUA->"; SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 11); cout << "\n|--------------------|\n"; cout << "\n|2 con chay bang nhau|\n"; cout << "\n|--------------------|\n"; } delete a1; delete a2; } } while (con1 != 0 && con2 != 0); } int main() { sosanhtocdogiàconvat(); system("pause"); return 0; }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.