Skip to content

animysore/computer-class

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Computer Class

This is a repository containing all the C++ programs required for the IT files for classes 11 and 12. Modify and use this code as you please for your own practical file. Do not copy directly.

Fork this repository, and create a pull request if you wish to contribute.

####Maintained by Aniruddha Mysore, with Ayush Patel

#Program list:

##Class 11

No. Program Description
1. Write a C++ program to accept to two integers and perform all arithmetic operations on them.
2. Write a C++ program to accept radius of a circle, calculate and print area and circumference.
3. Write a C++ program that accepts marks in 5 subjects and outputs average marks.
4. Write a C++ program to compute the simple interest.
5. Write a C++ program that reads temperature in Celsius and displays it in Fahrenheit.
6. Write,a C++ program to enter height in cm, and print the height in equivalent feet,and inches. [1 foot = 12 inches, 1 inch = 2.54 cm]
7. Write a C++ program that input total days from the user and convert it to equivalent years, weeks and days.
8. Write a program which accepts amount as integer and display total number of Notes of Rs. 500, 100, 50, 20, 10, 5 and 1. For example, when user enter a number, 575, the results would be like this... 500: 1, 100: 0, 50: 1, 20: 1, 10: 0, 5: 1, 1: 0
9. Write a C++ program to input an uppercase and lowercase letter in two separate character variables respectively and change its case without using built-in functions.
10. Write a C++ program to:(i) Print ASCII code for a given digit.(ii) Print ASCII code for backspace.
11. Write a C++ program to swap the values of two variables:(i) Using temporary variable.(ii) Without using temporary variable.
12. Write a C++ program using manipulators to display the output in following formats:
$$$$$HELLO
$$$$$$HELL
$$$$$$$HEL
########HE
#########H
13. Write a C++ program using to accept a value 789.1234 from user in a variable and display it in following format using manipulators.
+789.1
+789.12
+789.123
+789.1234
+789.12340
+789.123400
+789.1234000
14. Write a C++ program to input a number. If the number n is odd and positive, print its square root otherwise print n5.
15. Write a C++ program to input principal, amount and time. If time is more that 10 years, calculate the simple interest with rate 8%. Otherwise, calculate it with rate 12% per annum.
16. Write a C++ program to input a student type (‘A’ or ‘B’). If the student type is ‘A’ initialize the college account with Rs. 200/- otherwise initialize the hostel account with Rs. 200/-.
17. Write a C++ program to input three integers and print the largest and smallest of three.
18. Write a C++ program that reads in a character from the keyboard and then displays one of the following messages:
(i) If is a lower case letter, the message “The upper case character corresponding to,is ….”
(ii) If is an upper case letter, the message “The lower case character corresponding to,is ….
(iii) If is not a letter, the message “ is not a letter”
19. An electricity board charges according to following rates: For the first 100 units – 40 P per unit. For the first 100 units – 40 P per unit. For the next 200 units – 50 P per unit. Beyond 300 units – 60 P per unit. All users are charged meter charge of Rs. 50/-. Write a C++ program to read the name of user and number of units consumed, and print out the charges with name.
20. Write a C++ program to find and print the roots of quadratic equation ax2 + bx + c = 0. Also print the nature of roots.
21. Write a C++ program to find the area of a triangle and find its type.
22. Write a C++ program to input a month number and print number of day in month using switch.
23. Write a C++ program to print first n natural numbers and their sum.
24. Write a C++ program to print the multiplication table of a given number.
25. Write a C++ menu driven program to perform arithmetic calculation using switch. The program inputs two operands and an operator and then displays the calculated result.
26. Write a complete C++ program to do the following:
(i) Read an integer X
(ii) Form an integer Y by reversing the digits of X and integer S having sum of digits of X.
(iii) Output Y and S
27. Write a C++ program to check if the given number is prime or not.
28. Write a C++ program to find the sum of the following series:
(i) x – x2/2! + x3/3! – x4/4! + x5/5! – x6/6!
(ii) x + x2/2 + x3/3 + ……….+ xn/n
29. Write a C++ program using nested loops to produce the following design:
1 2 3 4 5
1 2 3 4
1 2 3
1 2
1
30. Write a C++ program using nested loops to produce the following design:
A
A B
A B C
A B C D
A B C D E
31. Write a C++ program using nested loops to produce the following design:
&&&&&&&
&&&&&
&&&
&
30. Write a C++ program using nested,loops to produce the following design till the entered digit. For e.g. if,user enters 5 then the output should be
1
121
12321
1234321
123454321
31. Write a C++ program that checks whether the given character is alphanumeric or a digit.
32. Write a C++ program that checks whether a given character is an alphabet or not. If it is an alphabet, whether it is lowercase character or uppercase character.
33. Write a C++ program that reads two strings, appends the first string to the second and displays it. The program should also display the length of concatenated string.
34. Write a C++ program with functions to calculate LCM and GCD of two numbers.
35. Write a function interest( ) to calculate simple interest. The function intakes two int values principal and time and one float value rate. Write a C++ program to calculate simple interest by using a default value of 2 for argument time and 0.10 for argument rate. Also write code to get the value of principal, time and rate from the user to override the default values for time and rate and display the calculated result.
36. Write a C++ program that invokes a function satis( ) to find whether four integers a, b, c and d sent to satis( ) satisfy the equation a3 + b3 + c3 = d3 or not. The function satis( ) returns 0 if the above equation is satisfied with the given four numbers otherwise it returns -1.
37. Write a C++ program with function that intakes two int arguments and returns reference of the odd number out of the two. If both the arguments are odd, then the reference of the smaller one is returned.
38. Write a C++ program that uses following functions:
(i) sqlarge( ) that is passed two int arguments by reference and then sets the larger of the two numbers to its square.
(ii) sum() that is passed an int argument by value and that return the sum of the individual digits of the passed number.
(iii) main() function that exercises above two functions by getting two integers from the user and by printing the sum of the individual digits of the square of the larger number.
39. Write a C++ program to display the maximum, minimum and average of all the elements of a one dimensional integer array.
40. Write a C++ program to initialize a one dimensional array of integers at the time of declaration and then copy all the odd elements in ODD array and even elements in EVEN array.
41. Write a C++ program to read a string and convert each lowercase character to uppercase, uppercase character to next alphabet in the sequence, replace all special characters with *.
42. Write a C++ program that reads two strings and copies the shorter string into the bigger string.
43. Write a C++ program to sort single dimensional array of integers.
46. Write a C++ program to reverse word of a string individually e.g. if you enter I love C++, it should display: I evol ++C
47. Write a C++ program to calculate average score & grade for n students from m subject scores.
average score < 45, grade is D
average score,45-60, grade is C
average score 60-75, grade is B
average score 76-90, grade is A
48. Write a C++ program initialize a two dimensional integer array of 4 rows and 3 columns at the time of declaration and display sum of each row and each column.
49. Write a C++ program to find the sum of elements on the diagonal, sum of upper triangle, sum of lower triangle of a square matrix n x n. Also display the corresponding elements in a matrix form
50. Write a C++ menu driven program to add and multiply two matrices depending upon user’s choice. Use separate functions to create, display, add and multiply two matrices.
51. Write a C++ program to read two strings firstname and lastname. Concatenate them without using built-in function.
52. Write a C++ program that gives a user an option to create list of 10 Names, Search for a given name in the list and Sort the names in Alphabetical order. Program should run as long as the user wants. Use separate functions for create, search and sort.
53. Write a C++ program with function that checks whether or not two arrays (of characters) are identical, that is, whether they have same characters and all characters in corresponding positions are equal. If the two arrays are identical, the function returns 1, otherwise returns 0.
54. Declare a structure called Emp with variables empno, days_worked of type int, name of type array of characters and basic, hra, da, cca, pt_rate and it_rate of type float. Write a C++ program to store detail about an employee and calculate grosssalary and netsalary as follows and display it:
grosssalary = basic x days_worked/26 + basic x hra/100 + basic x da/100 + cca
netsalary = grosssalary – (basic x it_rate/100 + basic x pt_rate/100)
55. Create a structure called Volume that uses three variables (Length, Width, Height) of type distance (feet and inches) to model the volume of a room. Read the three dimensions of the room and calculate the volume it represents and print out the result. The volume should be in (feet)3 form i.e. you will have to convert each dimension in to feet and fractions of foot. For instance, the length 12 feet 6 inches will be 12.5 feet.
56. Declare a structure to store country information like countryname, capital, and percapita_income. Write a menu driven C++ program with functions to do the following:
(i) To read a country’s name and display capital and per-capita income. Display an error message in case of an incorrect input.
(ii) To sort the country records by countryname.
57. Write a C++ program to create structure called Student with variables (rollno, name and marks in three subjects). Store details of 5 students and display a list of students who have failed in more that one subject, assuming 40% as pass marks. Also write a function to print the sorted list of students to the console. You should sort first by firstname and then lastname.
58. Write a C++ program with function that accepts number of seconds as input and converts it into hh mm ss format of structure type Time. Use call by reference method.
59. Create a structure Time with variables hh, mm and ss. Write a C++ program with function that accepts a time variable and updates time by 1 second. The main() should display both the original time and updated time.
60. Declare a structure Complex to represent a complex number having a real part and imaginary part. Write C++ functions to add and subtract two complex numbers. The function add() intakes to structure arguments by value and returns another structure of Complex type with the result addition. The function subtract() intakes two structure arguments by reference and stores the difference of first and second complex number in the first one.

##Class 12

No. Program Description
1. Given a list of integers, write a program to find those which are palindromes. For example, the number 4321234 is a palindrome as it reads same from left to right and right to left.
2. Write a C++ program to sum the sequence x – x2/!2 + x4/!4 - x6/!6 + x8/!8 ……
3. Write a function sum() in C++ with two arguments, double x and int n. The function should return a value of type double and it should find the sum of the following series 1,– x/!1 + x3/!2 - x5/!3 + x7/!4 ………+ x 2*n-1/!n
4. Write a program to input any string and print the number of words , characters and spaces present in the string.
5. Write a program using function arrayprime(),with argument as int array to print the prime elements of an array.
6. Write a program to print the following patterns
A
A B
A B C
A B C D
A B C D E
*
* *
* * *
* * * *
* * * * *
7. Write a program to print sum of elements above and below the main diagonal of a matrix.
8. Write a program to display row sum and column sum of a matrix.
9. Write a C++ program that invokes a function calc() which takes two integers and an arithmetic operator and prints the corresponding result.
10. Write a C++ program to calculate factorial of an integer.
11. Write a C++ program that uses an area() function for the calculation of area of a triangle or a rectangle or a square. Number of sides( 3 for triangle, 2 for rectangle and 1 for square) suggest about the shape for which area is to be calculated..
12. Write a C++ program using concept of function overloading that uses function to check whether a given number is divisible by another number or not. However, if the second number is missing , the function checks whether the given number is prime or not.
13. Write a C++ program to declare a class to represent bank account of 5 customers with the following data members, Name of the depositor, Account number, Type of account, (S for savings and C for current), Balance amount. The class also contains member functions to do the following : To initialize data members , To Deposit money, To withdraw money after checking the balance (minimum balance is 1000), To display the data members.
14. Write a C++ program to activate storing/ representation of a video cassette in a video library. The following data members are included within the class viz. Serial number, Name of the cassette, type of movie, price, number of copies available. The function should also include the following member functions viz. To accept information of ten records for storage in the array, To display the name of the cassette with the maximum number of copies, To display the list stored in ascending order of number of copies available.
15. Imagine a publishing company that markets both books and audio cassette versions of its works. Create a class publication that stores the title ( a string) and price (type float) of a publication. From this derive two classes : book, which adds a page count (type int) and tape, which adds a playing time in minutes (type float). Each of these three classes should have a getdata() function to get its data from the user from the keyboard, and a putdata() function to display its data. Write a program to test the book and tape classes by creating instances of them asking the user to fill in their data with getdata() and a putdata() function to display its data.
16. Write a C++ program to define a class Clothing with the following descriptions :
Private members : Code of type string, Type of type string, Size of type integer, Material of type string, Price of type float. A function Calc_Price() which calculates and assigns the values of Price as follows : For the value of material as “COTTON”, if type is TROUSER , 1500 , if it is SHIRT , 1200. For material other than “COTTON” the above mentioned price gets reduced by 25%.
Public Members : A Constructor to assign initial values of Code, Type and Material with the word “NOT ASSIGNED” and size and price with 0. A function enter() to input the values of the data members Code, Type, Size and Material and invoke the Calc_Price() function. A function Show() which displays the content of all the data members for a clothing.
17. Write a C++ program to define a class Tour with the following descriptions :
Private members : TCode of type string, NoofAdults of type integer, NoofKids of type integer, Kilometres of type integer, TotalFare of type float. A function AssignFare() which calculates and assigns the values of the Data Member TotalFare as follows. For each Adult, Fare(Rs) is,500 For >=1000 Kilometres, 300 for = 500 Kilometres, and 200 for <200 Kilomeres. For each Kid the above Fare will be 50% of the Fare.
Public Members: A Constructor to assign initial values as follows : TCode with the word “NULL” , NoofAdults as 0 , NoofKids as 0, Kilometres as 0, TotalFare as 0. A function EnterTour() to input the values of the data members TCode, NoofAdults, NoofKids and Kilometers; and invoke the AssignFare() Function. A function ShowTour() which displays the content of all the data members for a Tour.
18. Write a C++ program that creates a file “Article.Txt” and count and display the words “this” and “these” present in the file.
19. Write a C++ program that reads from a file “MIX.Txt” containing words in uppercase and lower case letters and create another files “Upper.Txt” and “Lower.Txt” containing the words starting with uppercase letters and words starting with lowercase letters respectively.
20. Write a C++ program that creates a file “Story.Txt” and count and display no. of vowels, no. of digits, and no. of spaces in the file.
21. Write a Menu driven C++ program that will allow to Add, Display, Search, Modify and Delete records in a binary File “Data.dat”. Design your,own class,with data members and member function.
22. Write a Menu driven C++ program (Using Structure Student )that will allow to Add, Display, Search, Modify and Delete records in a binary File “Student.dat”. Design your own structure,“Student”.
23. Write a C++ program to read a 2-D array using pointers (i.e. Dynamic Array), calculate its row sum and column sum and display this array along with row sum and column sum.
24. Write a C++ program illustrating the use of this pointer.
25. Write a C++ program having a function to search an element in an one dimensional array using binary search method. If the element is not present function returns 0 otherwise the index where the element is found.
26. Write a C++ program to insert a new element in an ascending sorted Array.
27. Write a C++ program to delete an element from an ascending sorted Array.
28. Write a C++ program to sort an array of objects of structure Employee in descending order of salary with the help of Bubble sort using a function in which array and its size is passed as arguments. Definition of structure employee is as follows
struct Employee {
int Eno;
char Name[20];
float salary;
};
29. Write a C++ program to sort an integer array using Insertion Sort technique.
30. Write a C++ program to sort an integer array using Selection Sort technique
31. Suppose A,B,C are arrays of integers of size M,N and M+N respectively. The numbers in array A appear in ascending order while the numbers in array B appear in descending order. Write a C++ program having a user defined function to produce the third array C by merging arrays A and B in ascending order. Use A, B, C as arguments in function.
32. Write a C++ program to merge two arrays of integers X and Y of sizes m and n respectively using a function MERGE(int A[], int m, int B[], int n, int C[] ) which will produce a third array named Z , such that the following sequence is followed
(i) All odd numbers of X from left to right are copied into Z from left to right.
(ii) All even numbers of X from left to right are copied into Z from right to left.
(ii) All odd numbers of Y from left to right are copied into Z from left to right.
(ii) All even numbers of Y from left to right are copied into Z from right to left.
33. Write a program in C++ which using a function having arguments as array and its size assigns the element into a two dimensional array of integers in the following format
If the array is 1 2 3 4 5 6,
1 2 3 4 5 6
1 2 3 4 5 0
1 2 3 4 0 0
1 2 3 0 0 0
1 2 0 0 0 0
1 0 0 0 0 0
34. Write a Menu driven program to do the following Matrix operations
*********************** MENU**********************************
*********************** 1. Addition of Matrix ***********************
*********************** 2. Multiplication of Matrix ******************
*********************** 3. Exit ***********************************
35. Write a Menu driven program to do the following operations in a Matrix
************************ MENU**********************************
************************ 1. Sum of both Diagonals ******************
************************ 2. Display Upper half of Matrix *************
************************ 3. Display Lower Half of Matrix**************
************************ 4. Transpose of Matrix ********************
********************** 5. Exit ***********************************
36. Write a complete menu driven program in C++ to implement a dynamically allocated Stack containing names of countries.
37. Write a complete menu driven program in C++ to implement a dynamically allocated Queue containing names of cities.
38. Write a menu driven program in C++ to implement a circular Queue.
39. Write a menu driven program in C++ to implement a Stack as an array.
40. Write a menu driven program in C++ to implement a Queue as an array.

About

Practical-file programs for classes 11 and 12

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages