C++ Tutorials

31. File in C++ - Writing text to a file in C++

By: Babu : 2010-04-15

Description: This C++ program shows you how to open a file and write some text into that file and save it


32. Call by reference in C++ Functions

By: Babbar Ankit : 2009-05-30

Description: Apart from the method discussed in the first tutorial (highlighing the use of pointer arguements) ,  C++ provides the \'&\'(referential) operator for calling by reference.


33. Default arguments in C++

By: Babbar Ankit : 2009-05-30

Description: C++ provides the option of  providing default values to the arguments being passed to a function.


34. Function overloading in C++

By: Babbar Ankit : 2009-05-30

Description: C++ permits the use of two function with the same name. However such functions essentially have different argument list. The difference can be in terms of number or type of arguments or both.


35. Printing values in DEBUG mode in C++

By: Emiley J : 2007-09-17

Description: In addition to asserting that something is true using the assert() macro, you may want to print the current value of pointers, variables, and strings. This can be very helpful in checking your assumptions about the progress of your program, and in locating off-by-one bugs in loops. Listing below illustrates this idea.


36. Operator Precedence in C++

By: Kamini : 2007-09-17

Description: It is important to understand that operators have a precedence, but it is not essential to memorize the precedence. Use this table just in case you need a quick reference.


37. How to handle Exceptions in C++

By: Lakshmi : 2007-09-17

Description: In C++, an exception is an object that is passed from the area of code where a problem occurs to the part of the code that is going to handle the problem. The type of the exception determines which area of code will handle the problem, and the contents of the object thrown, if any, may be used to provide feedback to the user.


38. atoi(), itoa() in C++

By: Manoj Kumar : 2007-09-17

Description: The functions in stdlib you are likely to use most often include atoi(), itoa(), and the family of related functions. atoi() provides ASCII to integer conversion. atoi() takes a single argument: a pointer to a constant character string. It returns an integer (as you might expect). Listing below illustrates its use.


39. qsort() sample program in C++

By: Norman Chap : 2007-09-17

Description: qsort() takes four arguments. The first is a pointer to the start of the table to be sorted (an array name works just fine), the second is the number of elements in the table, the third is the size of each element, and the fourth is a pointer to a comparison function.


40. ctime() sample program in C++

By: Priya : 2007-09-17

Description: The standard library supplies the function time(), which takes a pointer to a time_t variable and fills it with the current time. It also provides ctime(), which takes the time_t variable filled by time() and returns an ASCII string that can be used for printing. If you need more control over the output, however, you can pass the time_t variable to local_time(), which will return a pointer to a tm structure. Listing below illustrates these various time functions.