// vcxzcv.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include #include #include bool Tinkamas(char const*Zodis) { char CSimb='o'; char* temp=(char*)strrchr(Zodis, CSimb); if (temp != NULL) { if(strlen(temp) == 1) return true; } else return false; } int Analizuoti(char **E, char** ism_zdz, bool pirmas) { int count = 1; if (pirmas) count = 0; char skirtukai[] = ":;\",. ()-_+=*'!@#$%^&[]{}\\/`~?|"; char* temp_zod; char* temp_eil = (char*)malloc(101); strcpy(temp_eil,""); char* buf=_strdup(*E); temp_zod = strtok(buf, skirtukai); while (temp_zod!=NULL) { if (Tinkamas(temp_zod)) { if (count%2) { strcat(temp_eil, temp_zod); strcat(temp_eil, " "); } else { strcat(*ism_zdz, temp_zod); strcat(*ism_zdz, " "); } count++; } else { temp_eil = strcat(temp_eil, temp_zod); temp_eil = strcat(temp_eil, " "); } temp_zod = strtok(NULL, skirtukai); } // free(buf); // free(temp_eil); return (count%2); } int _tmain(int argc, _TCHAR* argv[]) { char *E=(char*)malloc(101); char *ism_zdz=(char*)malloc(101); strcpy(E,"Valstybės saugumo departamento (VSD) veiklą tyrusio Seimo Nacionalinio saugumo"); strcpy(ism_zdz,""); printf("Input:%s\n",E); Analizuoti(&E,&ism_zdz,false); printf("Output:%s\n",ism_zdz); system("pause"); }