Help me with a string

Hi, i want appear in monitor this mensseger pmttbench_n=20\n=2\m=2\20_02_02_02_001.dat, but happen an error in char \: Look my code n' image:

https://uploaddeimagens.com.br/imagens/bagacinha-jpg

#include <iostream>
#include <string>

using namespace std;

int main()
{
string aux = "pmttbench_n=20\n=2\m=2\20_02_02_02_001.dat";

cout << aux << endl;

return 0;
}

closed account (E0p9LyTq)
You need to use double back-slashes (\\).

1
2
3
4
5
6
7
8
9
10
11
12
13
#include <iostream>
#include <string>

using namespace std;

int main()
{
   string aux = "pmttbench_n=20\\n=2\\m=2\\20_02_02_02_001.dat";

   cout << aux << endl;

   return 0;
}


And please use code tags, it makes reading your source much easier.
http://www.cplusplus.com/articles/z13hAqkS/
http://www.cplusplus.com/articles/jEywvCM9/
Last edited on
Topic archived. No new replies allowed.