All pastes #266262 Raw Edit

Anonymous

public text v1 · immutable
·published 2006-12-03 23:21 UTC
rendered paste body
// vcxzcv.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
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&#279;s saugumo departamento (VSD) veikl&#261; 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");
}