Wednesday, 5 June 2013

Basic C++ Programming Excercises

  1. Check odd or even
  2. convert seconds to minutes
  3. convert seconds to hours
  4. convert seconds to minutes and hours
  5. convert minutes to seconds
  6. convert minutes to hours
  7. convert minutes to minutes and hours
  8. convert hours to minutes
  9. convert hours to seconds
  10. convert Fahrenheit to Celsius
  11. convert Fahrenheit to kelvin
  12. convert Celsius to Fahrenheit
  13. convert Celsius to kelvin
  14. convert kelvin to Celsius
  15. convert kelvin to Fahrenheit
  16. table of any number
  17. calculate HCF
  18. calculate LCM
  19. check perfect number
  20. reverse number
  21. display next prime number
  22. Program to add 2 numbers
  23. Find maximum of 2 numbers
  24. Find maximum of 3 numbers
  25. Find maximum of n numbers
  26. Swap 2 numbers
  27. Fibonacci series
  28. average of n numbers
  29. palindrome
  30. Calculate sum of digits
  31. Calculate reverse of a number
  32. Check a number prime or not
  33. Check a year leap year or not
  34. Check a character is vowel or not
  35. Check a character is digit or not
  36. Count number of vowels in a string
  37. Program to perform arithmetic operation
  38. Display list of 1 to 10 factorials
  39. Display list of 1 to 10 squares
  40. Program to add n integers
  41. Sum of 1 to 100 even number
42. Sum of 1 to 100 odd numbers
43. Sum of 1 to 100 numbers divisible by 4
44. Sum of 1 to 25 numbers
  45. Average of 1 to 35 numbers

Array Related-
  1. Reverse a array values
  2. Traversing
  3. Insert an element in array-
a)      At the begin
b)      At middle or any position except start or last
c)       At the end
d)      Insert an element in an array based on its position
e)      Insert an element in an array based on its value
4. Delete an element in array
a)    At the begin
b)      At middle or any position except start or last
c)      At the end
d)      Delete an element from an array based on its value
e)      Delete an element from an array based on its position
5. Searching an element in array
a)      Linear Search
b)      Binary Search
6. Sorting elements
a)      Bubble sort
b)      Selection sort
c)       Insertion sort
d)      Quick sort
e)      Merge sort
f)       Radix sort
g)      Tree sort
h)      Heap sort
7. Program to Swap First half with Last half of an Array
8. Program to Count numbers greater than 5
9. Program to Swap neighbor elements in an array
10. Program to print array values through Pointers
11. Program to find sum of an array using pointers
12. Program to find maximum in an array

String--
  1. Program to Concatenate Two Strings using strcat( )
  2. Program to Concatenate Two Strings without using strcat( )
  3. Program to Compare Two Strings using strcmp( )
  4. Program to Compare Two Strings without using strcmp( )
  5. Program to Copy String using strcpy( )
  6. Program to Copy String without using strcpy( )
  7. Program to Find Length of a String using strlen( )
  8. Program to Reverse a String using strrev( )
  9. Program to Reverse a String without using strrev( )
  10. Program to Input-Output Strings using Character Functions
  11. Program to Input-Output Strings using gets( ) and puts( )
  12. Program to Input-Output Strings using printf( ) and scanf( )
  13. Program to Find Length of a String Without using strlen( )
  14. Program to Find Whether a String is Palindrome or Not
  15. java charAt() mehod or extract a particular position character from String
  16. Program to Find Whether a String is Palindrome or Not without using String Functions

File Handling
  1. Program to Copy Contents of One File to Another 
  2. Program to Print a File and Count Number of Characters
  3. Program to Print a File and Count Number of words
  4. Program to Print a File and Count Number of lines

Matrix
  1. Sum of Individual Rows and Columns of a Matrix
  2. Program to find Sum of Diagonals in a Matrix
  3. Program to perform matrix Multiplication
  4. Program to perform transpose of a matrix
  5. Program to Display numbers divisible by 10 in a Matrix
  6. Program to find Sum of numbers divisible 2 or 3 in a Matrix
  7. Program to display Both Diagonal elements of a Matrix
       For Example:

Matrix:        1   2   3
                       4   5   6
                       7   8   9

        Diagonal 1: 1   5   9
        Diagonal 2: 3   5   7

  8. Program to Display Lower triangle of a Matrix
       For Example:

Input:       1   2   3             Output:    1
                4   5   6                              4   5
                7   8   9                              7   8    9
  9. Program to Display Upper triangle of a Matrix
       For Example:

Input:       1   2   3             Output:    1   2    3
                4   5   6                                 5    6
                7   8   9                                       9
10. Program to display Matrix with elements numbered with row < column else "0"
       For Example:

Output:       1   0   0   0  
                  1    2   0   0                              
                  1    2   3   0
1    2   3   4



Structure
  1. Example on Structure
  2. Program to illustrate returning structure from function
  3. Program to pass entire Structure from an Array
  4. Program for passing individual structure members through Function
  5. Program to illustrate Array of Structure
  6. Program to illustrate Nested Structure
  7. Program to Implement Structure with Array
  8. Program to Implement Structure with Function
  9. Program to Implement Structure with Pointers


Class
  1. Example on Class
  2. Friend Function Example
  3. Example 1 on Class
  4. Example 2 on Class

Constructor and Destructor
  1. Constructor and Destructor Example

Inheritance
  1. Inheritance with same Function name in Base and Derived Class
  2. Inheritance: Virtual Base Class Example

File Handling
  1. File Handling: Copy entire contents of a file into another
  2. File Handling: Searching a telephone number from a file

Stack and Queue
  1. Stack: Implemented using Array
  2. Queue: Implemented using Array
  3. Circular Queue: Implemented using Array

Linked List
  1. Stack: Implemented using Linked List
  2. Queue: Implemented using Linked List
  3. Circular Queue: Implemented using Linked List

0 comments:

Post a Comment