![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Apr 2006
Posts: 15
Rep Power: 0
![]() |
Quick question HELP!
Just got my crap to start working correctly. Just wanted to know one thing. What is the code for reseting the console screen? As in, in a simple counting and output loop, the numbers wont appear like this:
1 2 3 4 5 But will stay in place, and appear in the same spot. Basically, how do you make it so when you output anything, it restarts at the top, and you cannot read what has already been outputted? Last edited by Nickyj1211; Apr 17th, 2006 at 12:27 AM. |
|
|
|
|
|
#2 |
|
Battle Programmer
Join Date: Feb 2006
Location: Bellevue, WA, USA
Posts: 770
Rep Power: 3
![]() |
for(int i = 0; i < 100; i++) std::cout << "\n"; std::cout << std::endl; |
|
|
|
|
|
#3 | |
|
Programming Guru
![]() Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5
![]() |
Quote:
#include <iostream>
using namespace std;
int main()
{
for(int i = 0; i < 10; i++)
cout << i << '\b';
return 0;
}
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for." -- Socrates |
|
|
|
|
|
|
#4 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
I would enjoin you to think for forty or fifty seconds until you realize that an output device is a very implementation-specific thing. If you don't believe me, ask a blind person. A general-purpose, 'portable' language attempts to ignore the reality that an output device of some sort will ultimately be required. They leave it to the implementors. Don't go looking in the standard library for such things. You can find your ass with both hands much easier.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#5 | |
|
Newbie
Join Date: Apr 2006
Posts: 15
Rep Power: 0
![]() |
Quote:
|
|
|
|
|
|
|
#6 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
It IS very simple. It also depends entirely upon your implementation. Read your responses. Rub two brain-cells together. I'll bet you a hunnert bucks you can't clear the screen on a teletype machine without having to pay for a roll of paper. If you want to talk about kiddie machines like one finds on zillions of desktops, say so.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#7 |
|
Programming Guru
![]() ![]() ![]() |
I'm going to assume you are using windows. Below is non-portable code to clear the screen.
#include <conio.h> ... clrscr();
__________________
http://jasonpowers.net "There are a thousand hacking at the branches of evil to one who is striking at the root." |
|
|
|
|
|
#8 | |
|
Newbie
Join Date: Apr 2006
Posts: 15
Rep Power: 0
![]() |
Quote:
|
|
|
|
|
|
|
#9 | |
|
Newbie
Join Date: Apr 2006
Posts: 15
Rep Power: 0
![]() |
Quote:
|
|
|
|
|
|
|
#10 |
|
Programming Guru
![]() Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5
![]() |
Nicky you _really_ need to listen to DaWei. conio.h is not portable, we could give you code for *nix with the curses library, or some code for you Playstation Portable, but it's not going to be portable. Comprende?
You might also like to search the forums, this question has been asked multiple times and some semi portable solutions have been provided.
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for." -- Socrates |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|