Printing escape character
- by danutenshu
When I am given "d""\"/""b", I need to print out the statement character for character. (d, b, a slash, a backslash, and 5 quotes) in C++. The only errors that show now are the lines if(i.at(j)="\\") and else if(i.at(j)="\""). Also, how should the outside double apostrophes be excluded?
#include <iostream>
#include <cstdlib>
using namespace std;
int main (int argc, const char* argv[] )
{
string i= argv[1];
for (int j=0; j>=sizeof(i)-1; j++)
{
if(i.at(j)="\\")
{
cout << "\\";
}
else if(i.at(j)="\"")
{
cout << "\"";
}
else
{
cout << i.at(j);
}
}
return 0;
}