Functions of C++
Functions of C++
Similar to any array declaration , we create an array of the type Distance and give it a size of
100. i.e Distance dist[100].Array bound checking falls on programmer choice and can be
restricted using conditions such as :
if( n >= MAX )
{
cout << “\nThe array is full!!!”;
break;
}
This causes a break out of the loop and prevents the array from overflowing.
Accessing objects in an array
dist[j].showdist();
The standard C++ string Class
Standard C++ includes a new class called string. This class improves on the
traditional C-string in many ways.
The string class assumes all the responsibility for memory management. Also,
the string class allows the use of overloaded operators, so we can
concatenate string objects with the + operator:
s3 = s1 + s2
Defining and Assigning string Objects