Mail Archives: djgpp/1998/10/08/19:24:12
From: | qasic AT hotmail DOT com
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Help! Characters won't COUT
|
Date: | Thu, 08 Oct 1998 18:52:30 GMT
|
Organization: | Deja News - The Leader in Internet Discussion
|
Lines: | 61
|
Message-ID: | <6vj1le$gh2$1@nnrp1.dejanews.com>
|
NNTP-Posting-Host: | 207.23.214.161
|
X-Article-Creation-Date: | Thu Oct 08 18:52:30 1998 GMT
|
X-Http-User-Agent: | Mozilla/3.01 (Macintosh; I; PPC)
|
X-Http-Proxy: | 1.0 x12.dejanews.com:80 (Squid/1.1.22) for client 207.23.214.161
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
Hi:
I was wondering if anybody using DJGPP could tell me why the "*" won't print
correctly when this program is compiled using DJGPP. It works find using
Borland's C++ 4.5 but nothing is printed when I use DJGPP.
Thank you very much in advance.
Jason Downey
/*--------------------------- BEGIN PROGRAM
----------------------------------*/ /* Doodle Program */ /* WILL NOT
FUNCTION CORRECTLY IN DJGPP */
#include <iostream.h>
#include <conio.h>
#if __DJGPP__
#include <random.h>
#else
#include <stdlib.h> //this allows random stuff to work
#include <time.h> //this allows random stuff to work
#endif
int main()
{
void randomize(void);
cout<<"Doodler! Press I/J/K/M to move, Q to quit"<<endl;
char KeyPressed; //Key pressed by user
int x=40;int y=10;
do {
gotoxy(x,y);cout<<'*'; //Plot a "point"
gotoxy(x,y); //move blinking cursor under current spot
KeyPressed=getch(); //get a key, not echoing to the screen
if (KeyPressed=='I' || KeyPressed =='i')
y--;
else if (KeyPressed=='M' || KeyPressed == 'm')
y++;
else if (KeyPressed=='J' || KeyPressed == 'j')
x--;
else if (KeyPressed=='K' || KeyPressed == 'k')
x++;
else if (KeyPressed=='Q' || KeyPressed == 'q')
; //do nothing
else
cout<<"\a"; //beep for bad keystroke
} while ((KeyPressed!='Q' && KeyPressed!='q'));
clrscr;
gotoxy(1,1); //clear and display new title
clreol;
cout<<"Random Stars! Press any key to stop"<<endl;
while (!kbhit()){
gotoxy(1+random(60),2+random(20));
cout<<"*"; //A star and a blank to draw AND erase
}
return(0);
}
/*--------------------------- END PROGRAM ----------------------------------*/
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
- Raw text -