[ create a new paste ] login | about

Link: http://codepad.org/ULiUggt5    [ raw code | output | fork ]

C++, pasted on Dec 1:
#include <stdio.h>
#include <string.h>

void swap(char& c1, char& c2)
 { char _tc = c1; c1 = c2; c2 = _tc; }

int main(int argc, char* argv[])
{
	char str[256] = "c++ is an object-or(ient)ed pro(gramm)ing la(ngua)ge\0";

	printf("%s\n",str);

	char pchars[] = "()\0"; bool found = false;
	char* tmp = new char[256]; int n = 0;
	for (int i = 0; str[i] != '\0'; i++)
		if (!strchr(pchars, str[i]) && !found) tmp[n++] = str[i];
		else if (str[i] == '(') found = true;
		else if (str[i] == ')') found = false;

	tmp[n] = '\0';

	strcpy(str,tmp);

	printf("%s\n",str);

	return 0;
}


Output:
1
2
c++ is an object-or(ient)ed pro(gramm)ing la(ngua)ge
c++ is an object-ored proing lage


Create a new paste based on this one


Comments: