Here is a C++ program to print escape characters
SOURCE CODE OUTPUT
#include<iostream>
#include<string.h>
using namespace std;
int main()
{
cout<<"Escape sequences : ASCII value"<<endl;
cout<<"\\' "<<int('\'')<<endl;
cout<<"\\\" "<<int('\"')<<endl;
cout<<"\\? "<<int('\?')<<endl;
cout<<"\\\ "<<int('\\')<<endl;
cout<<"\\0 "<<int('\0')<<endl;
cout<<"\\a "<<int('\a')<<endl;
cout<<"\\b "<<int('\b')<<endl;
cout<<"\\f "<<int('\f')<<endl;
cout<<"\\n "<<int('\n')<<endl;
cout<<"\\r "<<int('\r')<<endl;
cout<<"\\t "<<int('\t')<<endl;
cout<<"\\v "<<int('\v')<<endl;
return 0;
}
#include<string.h>
using namespace std;
int main()
{
cout<<"Escape sequences : ASCII value"<<endl;
cout<<"\\' "<<int('\'')<<endl;
cout<<"\\\" "<<int('\"')<<endl;
cout<<"\\? "<<int('\?')<<endl;
cout<<"\\\ "<<int('\\')<<endl;
cout<<"\\0 "<<int('\0')<<endl;
cout<<"\\a "<<int('\a')<<endl;
cout<<"\\b "<<int('\b')<<endl;
cout<<"\\f "<<int('\f')<<endl;
cout<<"\\n "<<int('\n')<<endl;
cout<<"\\r "<<int('\r')<<endl;
cout<<"\\t "<<int('\t')<<endl;
cout<<"\\v "<<int('\v')<<endl;
return 0;
}
Any questions regarding to program please write in comments.
No comments:
Post a Comment