CPP

246
3977 reads

February 12, 2013

Two-Dimensional Arrays


This example shows calculation of grades of 4 students from 3 test scores using 2D array marks for storing the marks of each student & each test. sum is a 1D array used to store total marks.

21
1633 reads

February 12, 2013

Single Dimensional Arrays


Array is a collection of variables of the same type that are referenced by a common name. The data type of an array is known as it's base type. Array subscripts in C++ start with 0 not 1.

36
1603 reads

February 12, 2013

Add two array elements


This example has a loop, and one by one we will add the corresponding elements of the arrays . This is a simplified way to add two arrays.

33
1825 reads

February 12, 2013

Bubble Sort


In the bubble sort, as elements are sorted they gradually "bubble" (or rise) to their proper location in the array, like bubbles rising in a glass of soda.

53
1591 reads

February 12, 2013

Array as parameters


This example demonstrates passing array as parameters.

54
1617 reads

February 12, 2013

Two Dimensional Arrays


An array is a series of elements of the same type placed in contiguous memory locations that can be individually referenced by adding an index to a unique identifier.

28
1574 reads

February 12, 2013

Binary Search Function


Do you remember playing the game "Guess a Number", where the responses to the statement "I am thinking of a number between 1 and 100" are "Too High", "Too Low", or "You Got It!"?

70
1695 reads

February 11, 2013

Binary Search


A binary search or half-interval search algorithm finds the position of a specified value (the input "key") within a sorted array.

22
314 reads

February 11, 2013

Bubble Sort


The idea is to pass through the data from one end to the other, and swap two adjacent elements whenever the first is greater than the last. Thus, the smallest elements will "bubble" to the surface.

54
1732 reads

February 11, 2013

Multidimensional arrays


Multidimensional arrays can be described as "arrays of arrays".