[ create a new paste ] login | about

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

C++, pasted on May 15:
#include <stdio.h>

#define N 7

int main(int argc, char* argv[])
{
	int A[N] = { 5, 4, 7, 8, 6, 8, 1 };

	bool b = false;
	for (int i = 0; i < N && !b; i++)
	{
		int count = 0;
		for (int k = i+1; k < N; k++)
			if (A[k] == A[i]) count++;

		if (count > 0) b = true;
	}

	if (b != false) printf("Duplicate elements found\n");

	return 0;
}


Output:
1
Duplicate elements found


Create a new paste based on this one


Comments: