Ass 1

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Assignment for Practical Files

Instruction of practical files

1. page use one one side lines and one side blanks
2. every next program start at new page.
3. compulsory the write output every program

DS
1.WAP and algorithm to demonstrate of array.

2.WAP and algorithm to perform the function of stack (1. Push 2. POP 3. Traverse Element)

3.WAP and algorithm to perform the function of queue (1. Rear 2. Front 3. Traverse
Element)

4. WAP and algorithm to perform the function of Cqueue (1. Insert 2. Delete 3. Traverse
Element)

C++
1. Write a program in C++ to print the sum of two numbers.
Sample Output:

Print the sum of two numbers :


-----------------------------------
The sum of 29 and 30 is : 59

2. Write a program in C++ to swap two numbers.


Sample Output:

Swap two numbers :


-----------------------
Input 1st number : 25
Input 2nd number : 39
After swapping the 1st number is : 39
After swapping the 2nd number is : 25

3. Write a program in C++ to calculate the volume of a cube.


Sample Output:
Calculate the volume of a cube :
---------------------------------------
Input the side of a cube : 5
The volume of a cube is : 125

4. Write a program in C++ to compute the total and average of four numbers.
Sample Output:

Compute the total and average of four numbers :


----------------------------------------------------
Input 1st two numbers (separated by space) : 25 20
Input last two numbers (separated by space) : 15 25
The total of four numbers is : 85
The average of four numbers is : 21.25

5. Write a program in C++ to check whether a number is positive, negative or zero.

Sample Output:
Check whether a number is positive, negative or zero :
-----------------------------------------------------------
Input a number : 8
The entered number is positive.

6. Write a C++ program to display the current date and time.


7. Write a C++ program to get the day of the week from a given date. Return the day
as a string. The format of the day is MM/DD/YYYY.
Date: 02/05/1980 Day of the week: Tuesday
Date: 01/24/1990 Day of the week: Wednesday
Date: 01/05/2019 Day of the week: Saturday
Date: 11/17/2022 Day of the week: Thursday

8. Write a C++ program to convert a given year to a century.


Year: 1900, Century of the year: 19
Year: 1999, Century of the year: 20
Year: 2000, Century of the year: 20
Year: 2010, Century of the year: 21
Year: 2020, Century of the year: 21

9. Write a C++ program to check whether a given year is a leap year or not.
Is Leap year: 1900? Century of the year: 0
Is Leap year: 1999? Century of the year: 0
Is Leap year: 2000? Century of the year: 1
Is Leap year: 2010? Century of the year: 0
Is Leap year: 2020? Century of the year: 1
10. Write a C++ program to count the number of days between two given dates.
Date Format -> YYYY-MM-DD
Days between 2022/01/31 to 2022/01/01 = 30
Days between 2000/01/31 to 2019/02/01 = 6938
Days between 1980/05/31 to 1995/12/12 = 5677

11. Write a C++ program to reverse a given string.


Example:
Sample Input: rnt
Sample Output: tnr
12. Write a C++ program to capitalize the first letter of each word in a given string.
Words must be separated by only one space.
Example:
Sample Input: cpp string exercises
Sample Output: Cpp String Exercises

13. Write a C++ program to find the largest word in a given string.
Example:
Sample Input: C++ is a general-purpose programming language.
Sample Output: programming

14. Write a C++ program to count all the vowels in a given string.
Example:
Sample Input: eagerer
Sample output: number of vowels -> 4

15. Write a C++ program to convert a given non-negative integer into English words.
Example:
Sample Input: 12
Sample Output: Twelve
Sample Input: 29
Sample Output: Twenty Nine

16. Write a C++ program to find the largest element of a given array of integers.

17. Write a C++ program to find the largest three elements in an array.
18. Write a C++ program to find the second largest element in an array of integers.

19. Write a C++ program to dynamically allocate an array of integers and strings and
initialize its elements.
20: WAP to draw a circle with radius of 80 pixels.

21: WAP to draw a circle with radius of 80 pixels on the center of screen.

22: WAP to Draw Rectangle by function in C -

23: WAP to Draw Ellipse by function in C -

24. WAP to calculate electricity bills.

25. WAP to perform the ATM operation-

o View Balance
o Withdraw Amount
o Deposit Amount

26.WAP to enter 5 student details just like name of student and UID Number and
Mobile Num and Total Marks.

You might also like