1

My instructor gave us some sample code and she used a \a1 \a2 \a3 \a4 \a5 Can someone tell me what it is used for? I can't find it online or in my textbook?

cout<<"\n\t\a\a1----INSERT A NODE IN A BINARY TREE.\a\a";
cout<<"\n\t\a\a2----PRE-ORDER TRAVERSAL.\a\a";
cout<<"\n\t\a\a3----IN-ORDER TRAVERSAL.\a\a";
cout<<"\n\t\a\a4----POST-ORDER TRAVERSAL.\a\a";
cout<<"\n\t\a\a5----EXIT.\a\a";
cout<<"\n\t\a\aENTER CHOICE::\a\a";
Mat
  • 202,337
  • 40
  • 393
  • 406
visanio_learner
  • 373
  • 3
  • 4
  • 12

4 Answers4

8

\a is "alert", or "bell". It's listed here, for instance. Running this on a terminal with an actual audible bell (or even a visual one, where the whole screen flashes briefly) would surely be horrible. That's rather strange code to get from an instructor.

The sequence \a1 is simply \a followed by the digit 1, it's not a two-letter escape code.

unwind
  • 391,730
  • 64
  • 469
  • 606
  • okay thank you, i am confused and searching in the whole internet and book, i didn't get any answer... but i know \a is a alert beep. – visanio_learner Mar 07 '12 at 12:14
  • The instructor wanted to really make sure you were paying attention. –  Apr 23 '13 at 12:03
4

\a is alert, \n is newline, \t is tabulation. 1 is 1 :-)

More here: http://msdn.microsoft.com/en-us/library/h21280bw(v=vs.80).aspx

Kos
  • 70,399
  • 25
  • 169
  • 233
2
  • \n - line break
  • \t - tabulation symbol
  • \a - sound in the console

So \a1 means \a sound and symbol 1

Seagull
  • 3,319
  • 2
  • 31
  • 37
1

\a are the speaker bells usually...

linello
  • 8,451
  • 18
  • 63
  • 109