Advertisement

A few beginner C++ questions

Started by April 03, 2002 03:40 PM
7 comments, last by Antonis Demetrios 22 years, 5 months ago
I am learning C++ in school with the Turbo C++ compiler. At home, though, I have Visual C++ 6.0. Anyway, I can''t use the very necessary functions clrscr() or getch() on VC++. I was wondering if anyone knows what the equivilent would by on VC++. I''m not sure this is the best forum for this question, but because it''s a beginners one and I''m a beginner, I hope I made the right choice. Thanks in advance. (note: I''m not a Windows programmer, yet, so any responses must deal with, ugh, DOS) I''ll think of a signature later...
______________________________I'm a Greek advocating the resurrection of the Byzantine Empire. Join me.
getch() is in conio.h, are you including it?
as for clrscr() theres system("cls") or you just simply print a load of newlines to the screen thus clearing it
Advertisement
Doh! You''re right! getch() does work! Sorry for my stupidity. Anyway, cls doesn''t. Any ideas why? Special syntax or anything? Do I just type cls?

I''ll think of a signature later...
______________________________I'm a Greek advocating the resurrection of the Byzantine Empire. Join me.
Oh, wait--I see. I type:

system("cls");

... and that clears the screen. I''ll give it a shot. Thanks.

Hey, wait, no, it doesn''t work. What''s going on here? Do I need to include a special file or something? Please respond or I''ll die.

I''ll think of a signature later...
______________________________I'm a Greek advocating the resurrection of the Byzantine Empire. Join me.
Someone posted an implementation of clrscr for VC++ somewhere in these forums earlier and you can also find it in forum FAQ on cprogramming.com.
---visit #directxdev on afternet <- not just for directx, despite the name
you need to add at the top of your program, #include <windows.h> that should do the trick!
Advertisement
You can just write your own clrscr():


  void ClearScreen(){for(int i =0; i < 25; i++)cout<<"\n"; //or cout<<endl;}  


that just prints out 25 new lines, effectivly clearing away the screen
President: Video Game Development Club of UCIhttp://spirit.dos.uci.edu/vgdc
You can just write your own clrscr():


  void ClearScreen(){for(int i =0; i < 25; i++)cout<<"\n"; //or cout<<endl;}  


that just prints out 25 new lines, effectivly clearing away the screen
Sorry about the double post
President: Video Game Development Club of UCIhttp://spirit.dos.uci.edu/vgdc

This topic is closed to new replies.

Advertisement