Mam tablice co przechowuje mi slowo "ELA" i chce zeby wypisal program od konca czyli wyjdzie "ALE" Moge prosic o jakas pomoc??
0
0
Ale w jaki sposób tablicę. W sensie, że cstringa czy stringa:
Wersja Cstring:
char str[] = "ELA";
for(size_t i = strlen(str)-1; i >= 0; --i)
putc(str[i]);
Wersja string:
std::string str = "ELA";
// Wersja z iteratorami (lepsza)
for(std::string::reverse_iterator i = str.rbegin(); i != str.rend(); ++i)
putc(*i);
// Wersja ze zmienną iteracyjną
for(std::string::size_type i = str.length()-1; i >= 0; --i)
putc(str[i]);