#include <iostream> #include <string.h> #include <stdio.h> #include <stdlib.h> #include <windows.h> using namespace std; int main() { setlocale(0, ""); int i = 0, j = 0, len; char q[1000]; char* result; char s; gets_s(q); result = strtok(q," ,.-"); memset(result, '\0', sizeof(result)); while (result != NULL) { s = result[strlen(result)-1]; result[strlen(result)-1] = result[0]; result[0] = s; cout << result; result = strtok(NULL," ,.-"); } } Code #include <iostream> #include <string.h> #include <stdio.h> #include <stdlib.h> #include <windows.h> using namespace std; int main() { setlocale(0, ""); int i = 0, j = 0, len; char q[1000]; char* result; char s; gets_s(q); result = strtok(q," ,.-"); memset(result, '\0', sizeof(result)); while (result != NULL) { s = result[strlen(result)-1]; result[strlen(result)-1] = result[0]; result[0] = s; cout << result; result = strtok(NULL," ,.-"); } } Consol
kageno, . Написать программу, которая во вводимом с клавиатуры тексте заменит первую букву на последнюю во всех словах текста и выведет результат на экран.
hokage, #include <iostream> #include <string> int main() { int c = 0; std::string s; while(std::cin >> s) { std::cout << s[s.length() - 1] << s.substr(1, s.length() - 2) << s[0] << " "; } } C #include <iostream> #include <string> int main() { int c = 0; std::string s; while(std::cin >> s) { std::cout << s[s.length() - 1] << s.substr(1, s.length() - 2) << s[0] << " "; } }