0

Hi,
I'm an absolute beginner in Visual C++ (Express Edition 2010). I've just been trying out this very simple program, and I can't get to use the '\b' tag like I did when I used Turbo C++ v4.5. The cursor moves backwards, but the text does not get erased, as it did with Turbo C++.
The code is:

#include<iostream>
#include<conio.h>
using namespace std;
void main()
{
	cout<<"Hello";
	cout<<"\b\b";
	_getch();
}

The output is
Hello
(Underline represents cursor position).
What am I doing wrong? Any help would be appreciated.

Edited by aashishsatya: grammar

2
Contributors
1
Reply
3
Views
5 Years
Discussion Span
Last Post by LRRR
1

I've never used Turbo C++, but you can get similar results by moving the cursor backwards, and then replacing the letters with white spaces.

std::cout << "2 + 2 = 4\b5" << std::endl; // replaces 4 to 5
std::cout << "erase\b\b  " << std::endl; // replaces "se" with white spaces

Edited by LRRR: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.