C++ Tutorial/Development/Escape sequence


Deprecated: Constant E_STRICT is deprecated in /var/www/cppe.ru/www/includes/exception/MWExceptionHandler.php on line 179

Deprecated: Creation of dynamic property PPDStack::$accum is deprecated in /var/www/cppe.ru/www/includes/parser/Preprocessor_DOM.php on line 803

Deprecated: Constant E_STRICT is deprecated in /var/www/cppe.ru/www/includes/exception/MWExceptionHandler.php on line 179

Deprecated: Constant E_STRICT is deprecated in /var/www/cppe.ru/www/vendor/mediawiki/at-ease/src/Functions.php on line 48
Материал из C\C++ эксперт
Перейти к: навигация, поиск

Escape keys for double back slash

#include <iostream>
using namespace std;
int main()
{
  cout << "are quite \"useful \" \a \\ in your code \\ \a \n";
  return 0;
}
are quite "useful "  \ in your code \

Escape sequences: \b

#include <iostream> 
using namespace std; 
 
int main() 
{ 
  cout << "123\b\b45"; 
 
  return 0; 
}
145"

Escape sequences: \t

#include <iostream> 
using namespace std; 
 
int main() 
{ 
  cout << "one\ttwo\tthree\n"; 
 
  return 0; 
}
one     two     three

Use the \n code to generate a new line.

#include <iostream> 
using namespace std; 
 
int main() 
{ 
  cout << "one\n"; 
  cout << "two\n"; 
  cout << "three"; 
  cout << "four"; 
 
  return 0; 
}
one
two
threefour"