Programs

Coding:
1. Write a C++ program to perform linear search.

2. Write a C++ program to find whether given triangle is isosceles or not.

3. Write a C++ program which calculates grade of every student.

Range
Grade
>90
O
90<to>80
C
80<to>70
B
70<to>60
A
<60
E

4. Write a C++ program to calculate area & perimeter of rectangle by getting length & breath as input using classes.

5. Write a C++ program to add two complex nos to produce resultant using classes.

6. Write a C++ program to design a calculator using class.
           
7.Calculate area & Perimeter of circle using all kinds of constructor & destructor.


8.Write a program in C++ using classes to calculate the area of a circle , a rectangle and a   triangle on user’s choice.

9- Write a program in C++ using classes to find out whether the entered number is automorphic or not.

10-Assume that a bank maintains two kinds of accounts for its customers, one called as savings account and other as current account. The savings account provides compound interest and withdrawal facilities but no checkbook facility. The current account provides checkbook facility but no interest. Current account holders should maintain a minimum balance  and if the balance falls below this level as service charge is imposed.
Create a Class account that stress customer name, account number and type of account. From this derive Classes cur_account and sav_account to make them more specific to their requirements include necessary member functions in order to achieve the following tasks:
1) Accept deposits from a customer and update the balance.
2) Display the balance.
3) Compute and deposit the interest.
4) Permit withdrawal and update the balance.
5)Check for the minimum balance and impose penalty necessary and update the balance.

11- Write a program in C++ to create Class called complex and implement addition and subtraction of complex numbers by overloading the functions add and subtract which returns the complex number. Also overload the operator “<<” to display a complex number.

12- Write a program in C++ to create a Class Date and add and subtract two valid dates. Illustrate the use of copy constructor.

13- Write a program in C++ using classes to enter the data of an employee and display it.

14-Write a program in C++ to create a  linked list  with insert_front and delete_front as member functions by creating to objects. Use constructor to initialize the objects.

15- Write a program in C++ to create a Class Octal to perform decimal to octal conversion and addition of an octal and an interger by overloading ‘+’ and ‘=’.

16-Create a Class time that has separate int member data for hours,minutes and seconds.One constructor should initialize this data to 0 and another should initial;ize it to fixed values. Another member function should display it in 11:59:59 format. The final member function should add two time objects passed as arguments.

17-Write a program to creat a base Class shape. Use this Class to store two double type values that could be used to compute the area of figures. Derive two specific classes triangle and rectangle from the base class shape.Add to the base class a member function get_data() to initialize base class data members and another function display_area() to compute and display the area of figures.Make the display_area function a virtual function and redefine this function in the derived classes to suit their requirements.
Using these three classes design a program that will accept dimensions of a triangle or a rectangle interactively and display the area.


 General And Common Programs Asked In Technical Interviews:

               1.      Write a C++ program to calculate average marks scored by a                         student for 3 subjects.
2.      Write a C++ program to find the area and perimeter of a circle          and rectangle.
3.      Write a C++ program to swap two numbers.
4.      Write a C++ program to find largest of three numbers.
5.      Write a C++ program to find the maximum number among three numbers.
6.      Write a C++ program to generate Fibonacci series.
7.      Write a C++ program to perform string manipulation.
8.      Find the length of a string. Compare two strings, Concatenate two strings, Reverse a string, Copy a string to another location.
9.      Write a C++ program to find quotient and remainder of 2 numbers.
10.  Write a C++ program to manipulate the class account using classes and function. A user should be able to perform the following functions. a. Deposit money.   b. Withdraw money,  c. Calculate the interest   d. Check the total balance in his account.
11.  Write a C++ program to generate Prime numbers between 1 and 50.
12.  Write a C++ program to perform matrix addition and multiplication.
13.  Write a C++ program to check whether the given matrix is a sparse matrix or not.
14.  Write a C++ program to overload unary minus operator.
15.  Write a C++ program to calculate total sales and average sales made by a salesman.
16.  Write a C++ program to for construction in Derived Class to produce the report a employee in a company.
17.  Write a C++ program to display the student details using pointers.
18.  Write a C++ program to convert ASCII value to its equivalent character.
19.  Write a C++ program to overload a function to calculate volume of cube, cylinder and rectangular box.
20.  Write a C++ program to create a class template to find the maximum of two numbers.


Program Lists:

(C & C++ Programming)



Try these programs your self or discuss in groups:
Functions:
(1) find the factorial of an integer
(2) check whether a given integer number is a prime number
(4) find the prime numbers less than 100
     (5) find the greatest common divisor of two given integer numbers
(6) find the least common multiple of two given integer numbers

Arrays:

  1. Define an array A of 10 doubles.
  2. Define an array A of 10 doubles and set all of them to 1.0;
  3. Assume A is an array of N integers. Find the sum of the first and last entries and assign it to the third element.
  4. Write some code segment that prints out an array of doubles of size N
  5. Write some code segment that multiplies each element of an array by 2, storing it back in the array.

Arrays and Functions:


  1. Write a function that prints out an array of doubles of size N.
  2. Write a function that multiplies an array by a number. What are the possible function headers for such a function?
  3. Write a function that finds the sum of two arrays. What are the possible function headers for such a function?
  4. Write a function that adds up all elements in an array. What are the possible function headers for such a function.
  5. Write one function each to find (a) the maximum, (b) the minimum, and (c) the max and min of elements in an array. What are the possible function headers?
  6. Write a function that returns the location of the maximum value in an array. What are the possible function headers? Use that function in a main method.

No comments:

Post a Comment