[C++] Jak dodawać ASCII Art'y?


(xDarkness) #1

Witam.

Chciałbym się dowiedzieć jak dodawać do programu ASCII Art'y.

Otóż posiadam już program do ich tworzenia. Problem napotkałem przy umieszczaniu ich w programie, a dokładnie w instrukcji "std::cout".

Kompilator najwyraźniej ( po wklejeniu znaków alfanumerycznych tworzących obrazek do instrukcji "cout") traktuje je jak nazwy własne.

W obrazku występują tylko litery i cyfry, żadnych znaków typu " czy ; .

Obrazek posiada za to liczne spacje między literkami i cyframi.

Z góry dziękuję i pozdrawiam!!


(Drobok) #2

Trudno coś powiedzieć na temat podanego przez ciebie kodu ...


(Sawyer47) #3

W stałych napisowych w C++ niektóre sekwencje znaków są traktowane specjalnie, niektóre znaki można wpisać tylko przez specjalne sekwencje (przynajmniej przed C++11). Mówię tu oczywiście o http://en.wikipedia.org/wiki/Escape_character

Pokaż konkretny przykład, kod.

Tak na marginesie, "std::cout" to nie instrukcja.


([alex]) #4
cout<<"/ ***** \"<
cout<<"| |"<
cout<<"\ ***** /"<

(xDarkness) #5

Sądzę, że kod nie jest tu wymagany, ponieważ chodzi o zwyczajny przykład z użyciem biblioteki wyświetlającej tekst na ekranie.

Podaję jednak:

#include 

#include 


int main()

{

          std::cout<<"JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ

JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ

JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ

JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ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JJJJJJJJJJJJJJJJJJJJJJJ

JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJMMJJJJJJMMJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ

JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJMMJJJJJJJJJJMMJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ

JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJMMJJJJJJJJJJMMJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ

JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJMMJJJJJJJJJJMMJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ

JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJMMMMJJJJJJJJJJMMMMJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ"

system("pause");

}

([alex]) #6

Brakuje średnika:

... JJJ";


(Sawyer47) #7

Jeszcze nie spotkałem się, aby w pośćie na tym forum było za dużo informacji, zazwyczaj jest ich za mało. Lepiej podać wszelkie informacje, zresztą post zanim-cokolwiek-napiszesz-przeczytaj-ten-temat-t152275.html sugeruje załączenie kodu źródłowego.

A teraz co do problemu, odpowiedź w zasadzie znajduje się tutaj: http://stackoverflow.com/questions/1135 ... ng-literal

Aby uzyskać wielowierzowe stałe znakowe, trzeba albo umieścić po co najmniej jednej stałej w każdej linii i zostaną one automatycznie złączone lub na końcu każdej linii dopisać \ lub użyć raw strings z C++11.