Wednesday 31 July 2013

Programs List

  1. Write a C++ program to find the sum of individual digits of a positive integer.
  2. A Fibonacci sequence is defined as follows: the first and second terms in the sequence are 0 and1.Subsequent terms are found by adding the preceding two terms in the sequence.Write a C++program to generate the first n terms of the sequence.
  3. Write a C++ program to generate all the prime numbers between 1 and n ,where n is a value supplied by the user.
  4. Write C++ programs that use both recursive and non-recursive functions
    a) To find the factorial of a given integer.
    b) To find the GCD of two given integers.
    c) To find the nth Fibonacci number.
  5. Write a C++ program that uses a recursive function for solving Towers of Hanoi problem.
  6. Write a C++ program that uses functions
    a) To swap two integers.
    b) To swap two characters.
    c) To swap two reals.
    Note: Use overloaded functions.
  7. Write a C++ program to find both the largest and smallest number in a list of integers.
  8. Write a C++ program to sort a list of numbers in ascending order.
  9. Write a C++ program that uses function templates to solve problems-7&8.
  10. Write a C++ program to sort a list of names in ascending order.
  11. Write a C++ program to implement the matrix ADT using a class. The operations supported by this ADT are:
    a) Reading a matrix.                        c) Addition of two matrices.
    b)Printing a matrix.                         d)Multiplication of two matrices.
  12. Implement the matrix ADT presented in the problem-11 using overloaded operators (<<, >>, +, *) and templates.
  13. Implement the complex number ADT in C++ using a class. The complex ADT is used to represent complex numbers of the form c=a+ib, where a and b are real numbers.
    The operations supported by this ADT are:
          a) Reading a complex number.
          b) Writing a complex number.
          c) Addition of two complex numbers.
          d) Multiplication of two complex numbers.
  14. Write a C++ program that overloads the + operator and relational operators (suitable) to perform the following operations:      a) Concatenation of two strings.      b)Comparison of two strings.
  15. Implement the complex number ADT in C++ using a class. The complex ADT is used to represent complex numbers of the form c=a+ib, where a and b are real numbers.
    The operations supported by this ADT are:
          a) Reading a complex number.
          b) Writing a complex number.
          c) Addition of two complex numbers.
          d) Multiplication of two complex numbers.
    Note:      1. overload << and >> operators in part a) and part b).
          2. overload +, * operators in parts c) and d).
  16. Write a template based C++ program that determines if a particular value occurs in an array of values.
  17. Write a C++ program that uses functions to perform the following operations:
        a) Insert a sub-string into the given main string from a given position.
        b) Delete n characters from a given position in a given string.
  18. Write a C++ program that uses a function to reverse the given character string in place, without any duplication of characters.
  19. Write a C++ program to make the frequency count of letters in a given text.
  20. Write a C++ program to count the lines, words and characters in a given text.
  21. Write a C++ program to determine if the given string is a palindrome or not.
  22. Write a C++ program to make frequency count of words in a given text.
  23. Write a C++ program that displays the position or index in the string S where the string t begins , or –1 if S doesn’t contain t.
  24. 2’s complement of a number is obtained by scanning it from right to left and complementing all the bits after the first appearance of a 1. Thus 2’s complement of 11100 is 00100. Write a C++ program
    to find the 2’s complement of a binary number.
  25. Write a C++ program that counts the number of 1 bits in a given integer.
  26. Write a C++ program to generate Pascal’s triangle.
  27. Write a C++ program to construct of pyramid of numbers.
  28. Write a C++ program to compute the Sine series.
  29. Write a C++ program that converts Roman numeral into an Arabic integer.
  30. Write a C++ program which converts a positive Arabic integer into its
    corresponding Roman Numeral.
  31. Write a C++ program to display the contents of a text file.
  32. Write a C++ program which copies one file to another.
  33. Write a C++ program to that counts the characters, lines and words in the text file.
  34. Write a C++ program to change a specific character in a file.
    Note: Filename , number of the byte in the file to be changed and the new character are specified on the command line.
  35. Write a C++ program to reverse the first n characters in a file.
  36. Write a C++ program that uses a function to delete all duplicate characters in the given string.
  37. Write a C++ program that uses a function to convert a number to a character string.
  38. Write a C++ program that uses a recursive function to find the binary equivalent of a given non- negative integer n.
  39. Write a C++ program to generate prime numbers up to n using Sieve of Eratosthenes method.
  40. Write a C++ program
         a) To write an object to a file.
         b) To read an object from the file.
  41. Write C++ programs that illustrate how the following forms of inheritance are supported:
         a) Single inheritance
         b) Multiple inheritance
         c) Multi level inheritance
         d) Hierarchical inheritance
  42. Write a C++ program that illustrates the order of execution of constructors and destructors when new class is derived from more than one base class.
  43. Write a C++ program that illustrates how run time polymorphism is achieved using virtual functions.
  44. Write a C++ program that illustrates the role of virtual base class in building class hierarchy.
  45. Write a C++ program that illustrates the role of abstract class in building class hierarchy.