#include "pch.h"
#include <iostream>
using namespace std;
int main()
{
cout << "Strings\n\n";
char c = 'a';
cout << c << endl;
cout << (int)c;
/*
// Печать всех символов таблицы ASCII
for (size_t i = 0; i <= 255; i++)
{
c = i;
cout << c << " " << i << endl;
}
*/
// Проверка, является ли слово палиндромом
char s[100] = "KAZAK";
s[6] = '\0';
cout << endl << s;
cout << endl << strlen(s);
//cout << endl << s[25];
bool flag = true;
for (size_t i = 0; i < strlen(s); i++)
{
if (s[i] != s[strlen(s) - 1 - i])
{
flag = false;
break;
}
}
if (flag == true)
cout << "Palindrome";
else
cout << "Not a palindrom";
cout << (flag == false ? "Not a" : "") << " palindrom";
// Переворот строки
char s1[255] = "qwertyuiop";
// s1[10] = '\0';
cout << endl << s1;
for (size_t i = 0; i < strlen(s1) / 2; i++)
{
c = s1[i];
s1[i] = s1[strlen(s1) - 1 - i];
s1[strlen(s1) - 1 - i] = c;
}
cout << endl << s1;
// Поиск в строке
cout << endl << "t is at " << strchr(s1, 't') - s1;
cout << endl << "t is at " << strstr(s1, "tr") - s1;
s1[5] = 'T';
cout << endl << "In \"" << s1 << "\" char \"t\" is at ";
if (strstr(s1, "tr") != NULL)
cout << strstr(s1, "tr") - s1;
else
cout << "Not found";
cout << "\n\n\n";
}