User-submitted CPP Projects

350
4097 reads

February 1, 2013

String anagram


This example helps determine given two strings S1 and S2, whether one string is an anagram of the other. An anagram of a string is a string obtained by permuting the letters of a string.

147
1830 reads

January 31, 2013

String Reverse


This example displays the logic for string reversal.

254
2381 reads

January 31, 2013

String compare and copy


String comparison is done using strcmp(). The function takes two strings as parameters. The function returns 0 if the strings are same.

354
4614 reads

January 31, 2013

Strings Length


Null-terminated Strings in C++ are implemented using character arrays. The last element of the array-string is terminated by a null character '\0'.

33
914 reads
arpit's picture

Submitted by

arpit
Tags:

SearchBinary
A BASIC UNDERSTANDING OF "ARRAYS" AND "LOOPS" IS REQUIRED TO UNDERSTAND THIS ALGORITHM. Binary search algorithm is one of the fastest algorithms to find the position of a specified value (the input "
Run It Now!
28
1847 reads

January 30, 2013

Searching an array


This example shows how to iterate through an array and search for a particular entry. We set a flag if we find the particular value.

29
1674 reads

January 30, 2013

Sum of array elements


The program simply declares a 1-D array of 5 integers and initializes it. Then, it uses for-loop to traverse each element and adds it into result. Result finally returns the sum of all elements.

73
1609 reads

January 30, 2013

Roll numbers and Marks of 5 students


The code uses 2 arrays - marks and rno.

32
1625 reads

January 30, 2013

Declaration of Arrays


An array is simply a collection of similar data items. You can see in this example, an array of int type is declared. It consists of 5 elements stored sequentially in the memory.

261
3672 reads

January 30, 2013

Maximum in array


This example sorts the array in ascending order using the inbuilt sort function and then outputs the last element of array as it will be the maximum of all.