after the cin thing, the "cout" no longer works... but everything else works. Why?Code:/*****************************************************************************\ | This program will compile with Borland 5.5 or higher. | \*****************************************************************************/ #include <iostream> #include <conio> // for gotoxy + getch #include <cstdio> // for getchar #include <cstdlib> #include <new> // for the error handler #include <cstring> #include <ctime> //for delay + randomize #include <windows> #include <fstream> using namespace std; //#define Tgreen SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN) //#define Tint SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY) #define AR_MAX 9 // array maximum #define TOP 17 // the top of the control panel #define MENU_TOP 20 // top of the menu #define MENU_BTM 23 // bottom of the menu #define STR 0 // defines the position of certain abilities in the array #define AGL 1 // agility #define INT 2 // mana point #define MP_CRT 3 // current MANA #define MP_MAX 4 // max mana #define HP_CRT 5 // current HP #define HP_MAX 6 // max hp #define LVL 7 // level #define LM 8 // Lazy meter :) #define _a y++ // used in the hero attribute display #define name char const hero_name[256] // used when calling to a function (I am lazy ok??? :p ) int* status = new int [AR_MAX]; // attribute storage int message = MENU_TOP; // where what line to put message char* msg1; // message 1 char* msg2; char* msg3; char* msg4; //******************************8 void stop_watch(double seconds) { clock_t endwait; endwait = (clock () + seconds * CLK_TCK ); while (clock() < endwait) {} } //******************************8 void message_box(char* passage) /* this function put the messages in the message box into the log file Also, it will adjust itself when the message box has more than 4 messages. (ie 4 to 3, 3 to 2, and so on...). */ { ofstream log_file; log_file.open("message.log", ios::app); gotoxy(39,message); cout << passage; message++; if (message == 21) msg1 = passage; else if (message == 22) msg2 = passage; else if (message == 23) msg3 = passage; else if (message == 24){ // shift up message = 23; msg1 = msg2; msg2 = msg3; msg3 = msg4; msg4 = passage; } log_file << passage << endl; log_file.close(); return; } //******************************8 void mem_error(void) /* if there is a problem... */ { cerr << "Fatal Error (Out of Memory)"; getchar(); clrscr(); abort(); } //******************************8 void exit_prgm(void) /* called when the program exits */ { delete []status; // kill kill kill!!! printf("Clean Run"); getchar(); clrscr(); } //******************************8 void attribute_change(int const type, int const a) /* this function will change the integer on a requested attribute */ { status[type] += a; return; } //******************************8 void reset_attribute(int x) /* reset the attribute if needs arises (like when starting a new game) */ { int set; set = 10 + (rand()%10); // reset to 10-20 status[x] = set; // put to array if (x == MP_MAX) // adjust if current mana is higher than max mana status[MP_CRT] = status[MP_MAX]; else if (x == HP_MAX) // same thing for hp status[HP_CRT] = status[HP_MAX]; else if (x == LVL) // level!! status[LVL] = 1; else if (x == LM) // the lazy meter (1-10) status[LM] = 1 + rand()%10; return; } //******************************8 void display_attribute(int const x, int y, name) /* display the attribute of hero in the left area of the control panel */ { //Tgreen; gotoxy(x,y); cout << hero_name << endl; gotoxy(20,y); cout << status[LVL] << endl; //Tint; _a; gotoxy(x,y); cout << "Strength: " << status[STR] << endl; _a; gotoxy(x,y); cout << "Agility : " << status[AGL] << endl; _a; gotoxy(x,y); cout << "Mana Erg: " << status[INT] << endl; _a; gotoxy(x,y); cout << "Lazy Mtr: " << status[LM] << endl; _a; gotoxy(x,y); cout << "Magic Pt: " << status[MP_CRT] << "/" << status[MP_MAX] << endl; _a; gotoxy(x,y); cout << "Hit Pt : " << status[HP_CRT] << "/" << status[HP_MAX] << endl; return; } //******************************8 void fight() /* pick a fight UNFINISHED */ { attribute_change(MP_MAX, rand()%5); attribute_change(HP_MAX, rand()%5); attribute_change(LVL, 1); message_box("Max Magic Pt increased!"); message_box("Max Health increased!"); message_box("Level increased!"); return; } //******************************8 void heal() /* heals: When max hp is lower than current hp, it will adjust itself, same for mana will only restore one thing at a time, from 0 to 30 */ { int HP = rand()%30; // random heals amounts int MP = rand()%30; int MPorHP = rand()%2; // determine whether to heal mana or hp if ( (HP + status[HP_CRT]) > status[HP_MAX]) // check if current hp is higher than max hp HP = status[HP_MAX] - status[HP_CRT]; if ( (MP + status[MP_CRT]) > status[MP_MAX]) // same thing for mana MP = status[MP_MAX] - status[MP_CRT]; if (MPorHP == 0){ // if picked 0 attribute_change(HP_CRT, HP); message_box("Hit Points Restored!!"); } else{ // else attribute_change(MP_CRT, MP); message_box("Magic Points Restored!!"); } return; } //******************************8 void credits() /* display the credits in the message box */ { message_box("-----------------------"); message_box("Credits"); message_box(" "); stop_watch(2); message_box("Programmed by: someone"); message_box("Graphics by : someone"); message_box("-----------------------"); return; } //******************************8 void options(int Y) /* this function will check the position of the scroll bar and execute the correct command */ { if (Y == 20) // the fight position fight(); else if (Y == 21) // the heal position heal(); else if (Y == 22) // the about position credits(); else // the exit position exit(0); return; } //******************************8 void menu(int key, int &Y) /* this function will detect the movement of the scroll bar (up or down). This will also do the appropiate action when the enter key is hit */ { if (key == 72 && Y > MENU_TOP) --Y; else if (key == 80 && Y < MENU_BTM) ++Y; else if (key == 13) options(Y); return; } //******************************8 void display_msg() /* will display 4 messages at the message box */ { gotoxy(39,MENU_TOP); cout << msg1; gotoxy(39,MENU_TOP + 1); cout << msg2; gotoxy(39,MENU_TOP + 2); cout << msg3; gotoxy(39,MENU_TOP + 3); cout << msg4; return; } //******************************8 void display_HUD(name, int const Y) /* This function will display the control panel */ { char* HUD = "\ ÉÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍËÍÍËÍËÍÍÍÍÍÍËÍËÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»\ º ºLVL: º+-ÌÍÎÍMENUÍÎ͹ MESSAGES º\ º ÈÍÍÍÍÍÍ͹ ºº ºº º\ º º º ºFight!º º º\ º º º ºHeal º º º\ º º º ºAbout º º º\ º º º ºExit º º º\ º º ºº ºº º\ ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÊÍÍÊÍÊÍÍÍÍÍÍÊÍÊÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ"/*¼*/; gotoxy(1,TOP); cout << HUD; if (status[LM] >= 8){ // if lazy meter is equal to or higher than 8 gotoxy(1,TOP-1); cout << "DANGER, MIGHT FALL ASLEEP DURING ACTION!"; } display_attribute(3,TOP+1,hero_name); // display the stats display_msg(); // display the messages gotoxy (27, Y); // display the left scroll bar cout << "Û"; gotoxy (36, Y); // display the right scroll bar cout << "Û"; return; } //******************************8 int main() { srand(time(NULL)); ofstream log_file; // start a log file log_file.open("message.log", ios::app); // open the log file time_t hold_time; // initialize the time hold_time = time(NULL); log_file << endl << "------Start logging at " << ctime(&hold_time) << endl; // put the time at the log file to separate previous entries log_file.close(); // close it /*=======INITIALIZATION=======*/ atexit(exit_prgm); // set to point to this function when exiting set_new_handler(mem_error); // set to point to this function when a memory error occurs for (int x = 0; x < AR_MAX; ++x) // set all the attribute to random reset_attribute(x); /*====FURTHER DECLARATIONS====*/ char hero_name[256]; // name of hero int Y = MENU_TOP; int key; /*============================*/ // THE INTRODUCTION SCREEN GOES HERE cout << "Temp RPG" << endl; cout << "Name of our Hero: "; // ask for name cin.getline(hero_name, 256, '\n'); cout << "Hello, " << hero_name << endl; clrscr(); //display_attribute(10,10, hero_name); do{ if(kbhit()){ key = getch(); menu(key, Y); // check for the keys display_HUD(hero_name, Y); // display the panel } }while(key != 27); // until the escape key is hit return 0; } //******************************8