0
Escape Sequences setw
How to fix cout<<setw(10)<<"\\"""<<setw(20)<<"double quote"<<std::endl; cout<<setw(10)<<"\\\"<<setw(20)<<"Backslash"<<std::endl;
1 Antwort
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 << "\""; // -> "