unrecognized character escape sequence

Getting these errors:
1>c:\users\shawn\documents\visual studio 2013\projects\ghathica\ghathica\main.cpp(16): warning C4129: '|' : unrecognized character escape sequence
1>c:\users\shawn\documents\visual studio 2013\projects\ghathica\ghathica\main.cpp(16): warning C4129: ' ' : unrecognized character escape sequence
1>c:\users\shawn\documents\visual studio 2013\projects\ghathica\ghathica\main.cpp(16): warning C4129: '_' : unrecognized character escape sequence
1>c:\users\shawn\documents\visual studio 2013\projects\ghathica\ghathica\main.cpp(16): warning C4129: '(' : unrecognized character escape sequence
1>c:\users\shawn\documents\visual studio 2013\projects\ghathica\ghathica\main.cpp(17): warning C4129: '/' : unrecognized character escape sequence
1>c:\users\shawn\documents\visual studio 2013\projects\ghathica\ghathica\main.cpp(20): warning C4129: '_' : unrecognized character escape sequence
1>c:\users\shawn\documents\visual studio 2013\projects\ghathica\ghathica\main.cpp(21): warning C4129: '|' : unrecognized character escape sequence
1>c:\users\shawn\documents\visual studio 2013\projects\ghathica\ghathica\main.cpp(22): warning C4129: '|' : unrecognized character escape sequence
1>c:\users\shawn\documents\visual studio 2013\projects\ghathica\ghathica\main.cpp(22): warning C4129: '_' : unrecognized character escape sequence

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include<iostream>
#include<fstream>
using namespace std;

void ghathicaTitle();

int main()
{
	ghathicaTitle();
	return 0;
}
void ghathicaTitle()
{
	cout << "############################################################################\n";
	cout << "#  _______           _______ _________         _________ _______  _______  #\n";
	cout << "# (  ____ \|\     /|(  ___  )\__   __/|\     /|\__   __/(  ____ \(  ___  ) #\n";
	cout << "# | (    \/| )   ( || (   ) |   ) (   | )   ( |   ) (   | (    \/| (   ) | #\n";
	cout << "# | |      | (___) || (___) |   | |   | (___) |   | |   | |      | (___) | #\n";
	cout << "# | | ____ |  ___  ||  ___  |   | |   |  ___  |   | |   | |      |  ___  | #\n";
	cout << "# | | \_  )| (   ) || (   ) |   | |   | (   ) |   | |   | |      | (   ) | #\n";
	cout << "# | (___) || )   ( || )   ( |   | |   | )   ( |___) (___| (____/\| )   ( | #\n";
	cout << "# (_______)|/     \||/     \|   )_(   |/     \|\_______/(_______/|/     \| #\n";
	cout << "#                                                                          #\n";
	cout << "############################################################################\n";
                                                                   
}


Not really sure how to get around this. Any ideas?
\ is the character for an escape sequence so to output a backslash you must put \\.
So I put a \ next to ever \\ and it is saying the same thing for the | symbol. I guess just do the same thing? I also have been reading that I can display text from a .txt file using fstream. Would this be a more efficient way of doing things? I'm simply trying to create a banner that looks like the above code but displayed in the console.

Thank you for your time !
@Vorstoss

If you're still getting errors, you must have missed a couple of the backslash symbols.
Here it is with everything corrected, and I get no errors.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
void ghathicaTitle()
{
	cout << "############################################################################\n";
	cout << "#  _______           _______ _________         _________ _______  _______  #\n";
	cout << "# (  ____ \\|\\     /|(  ___  )\\__   __/|\\     /|\\__   __/(  ____ \\(  ___  ) #\n";
	cout << "# | (    \\/| )   ( || (   ) |   ) (   | )   ( |   ) (   | (    \\/| (   ) | #\n";
	cout << "# | |      | (___) || (___) |   | |   | (___) |   | |   | |      | (___) | #\n";
	cout << "# | | ____ |  ___  ||  ___  |   | |   |  ___  |   | |   | |      |  ___  | #\n";
	cout << "# | | \\_  )| (   ) || (   ) |   | |   | (   ) |   | |   | |      | (   ) | #\n";
	cout << "# | (___) || )   ( || )   ( |   | |   | )   ( |___) (___| (____/\\| )   ( | #\n";
	cout << "# (_______)|/     \\||/     \\|   )_(   |/     \\|\\_______/(_______/|/     \\| #\n";
	cout << "#                                                                          #\n";
	cout << "############################################################################\n";
                                                                   
}
Last edited on
C++11: Use raw string literals

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <iostream>
using namespace std;

void ghathicaTitle();

int main()
{
	ghathicaTitle();
	return 0;
}

void ghathicaTitle()
{
    cout <<
R"abcd(
###########################################################################
#  _______           _______ _________         _________ _______  _______  #
# (  ____ \|\     /|(  ___  )\__   __/|\     /|\__   __/(  ____ \(  ___  ) #
# | (    \/| )   ( || (   ) |   ) (   | )   ( |   ) (   | (    \/| (   ) | #
# | |      | (___) || (___) |   | |   | (___) |   | |   | |      | (___) | #
# | | ____ |  ___  ||  ___  |   | |   |  ___  |   | |   | |      |  ___  | #
# | | \_  )| (   ) || (   ) |   | |   | (   ) |   | |   | |      | (   ) | #
# | (___) || )   ( || )   ( |   | |   | )   ( |___) (___| (____/\| )   ( | #
# (_______)|/     \||/     \|   )_(   |/     \|\_______/(_______/|/     \| #
#                                                                          #
############################################################################
)abcd" ;

}

http://coliru.stacked-crooked.com/a/fb379227ddb1ec92
JLBorges (3502)

Thanks man, that's what I was looking to do. I need to read into raw string literals to understand them more. Thanks for your time!
Topic archived. No new replies allowed.