Escape Sequences setw | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Escape Sequences setw

How to fix cout<<setw(10)<<"\\"""<<setw(20)<<"double quote"<<std::endl; cout<<setw(10)<<"\\\"<<setw(20)<<"Backslash"<<std::endl;

20th Sep 2018, 4:29 AM
Ulysses Arellano
Ulysses Arellano - avatar
1 Answer
0
#include <iostream> #include <iomanip> using namespace std; int main() { cout<<setw(10)<<"\"\""<<setw(20)<<"double quote"<<std::endl; cout<<setw(10)<<"\\"<<setw(20)<<"Backslash"<<std::endl; return 0; } \ just initiates escape sequences or lets you add add a character like " or \ to a string if the character is typed directly after it: cout << "\\"; // -> \ cout << "\""; // -> "
20th Sep 2018, 6:46 AM
Aaron Eberhardt
Aaron Eberhardt - avatar