0% found this document useful (0 votes)
3 views

CSI_LAB_JOURNAL

The document is a comprehensive list of programming exercises in C++ and Visual Basic, detailing various programming concepts such as loops, conditional statements, functions, and event-driven programming. Each program includes a problem statement, aims, source code, and questions for further understanding. The document serves as a practical guide for students to learn and verify their programming skills.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

CSI_LAB_JOURNAL

The document is a comprehensive list of programming exercises in C++ and Visual Basic, detailing various programming concepts such as loops, conditional statements, functions, and event-driven programming. Each program includes a problem statement, aims, source code, and questions for further understanding. The document serves as a practical guide for students to learn and verify their programming skills.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 46

List of Programs

Expt. Name of the Program Page Date of Remarks Sign of


No. No. completion practical
completion

1 C++ Basics :Sum and


difference of numbers
2 Conditional statements in
C++
3 Loop statements in C++

4 Switch Case: Display the


Day
5 Functions in C++

6 Function Overloading

7 Function calling: Call by


reference & Call by value
8 Recursive Functions

9 Arrays in C++

10 Visual Basic: Area of a circle

11 Sum of numbers using loops

12 Calculator Application

1
2
SECTION-I
C++
Programming

3
4
Program no. 1

SUM AND DIFFERENCE OF NUMBERS


Date :
Aim : To study basic structure of a C++ program
…… /… /…
Problem statement

• Write a program in c++ that adds and subtracts the given two
numbers and display the sum and difference.
Initials for
Attendance • Enter the program and verify the execution of the same on the
computer.
Source program

#include <iostream.h>
#include <conio.h>
void main ()
{
int a,b,c,d;
Completion clrscr ();
for: cout<<"Enter value of a := ";
cin>>a;
1)Source cout<<"Enter value of b := ";
Program cin>>b;
c=a+b
cout << "The sum is : -"<<c;
2) Program d=a-b
Output cout <<"\n "The difference is : -"<<d;
getch();
3) Program }
Logic

4) Questions

Signature for
completion

5
Output after execution

Enter value of a: = 7
Enter value of b: = 5
The sum is : - 12
The difference is: 2

Explanation of program logic

1) Declaration of variables
2) Accept the numbers.
3) Add and subtract the numbers
4) Display the sum and difference

Questions:

1) Explain the structure of a C++ program.


2) State the operators in C++.

6
Program no. 2

CONDITIONAL STATMEMENTS IN C++

Date :
Aim : To study if else construct in C++.
…… /… /…
Problem statement

Write a program in c++

1) To find the greater number between two numbers


Initials for
Attendance 2) To check the given number is divisible by 9.
Enter the program and verify the execution of the same on the
computer.
Completion
for:
Source program
1)Source Program

2) Program
Output

3) Program Logic

4) Questions

Signature for
completion

7
8
9
Output after execution

Explanation of program logic

Questions:

1) Explain the if…. else statement in C++.


2) State the multiple if else --if statements in C++
10
Program no. 3

LOOP STATEMENTS IN C++

Date :
Aim : To study for and do... while loop in C++.
…… /… /… Problem statement

• Write a program in c++


1) To display the odd numbers from 1 to 100.
Initials for 2) To display the even numbers from 100 to 200.
Attendance
• Enter the program and verify the execution of the same on the
computer.
Source program

Completion
for:

1)Source
Program

2) Program
Output

3) Program
Logic

4) Questions

Signature
for
completion

11
12
13
Output after execution

Explanation of program logic

Questions:

1) Explain the difference between while and do while loop in C++.


2) What are the advantages of for loop compared to other loops?

14
Program no.4

DISPLAY THE DAY AS PER THE NUMBER ENTRY

Date :
Aim : To study the switch case constructs.
…… /… /… Problem statement

• Write a program in c++ to display the day using the switch case
construct. The user will input only the day number.
Initials for • Enter the program and verify the execution of the same on the
Attendance
computer.
Source program

Completion
for:

1)Source
Program

2) Program
Output

3) Program
Logic

4) Questions

Signature
for
completion

15
16
Output after execution

Explanation of program logic

Questions:

1) Explain the switch case construct.


2) What is the use of default case in switch statement?
17
18
Program no.5

PRODUCT OF NUMBERS USING FUNCTION

Date :
Aim : To study the function and related terms in C++.
…… /… /… Problem statement

• Write a function in c++ to multiply the two numbers and


display the product using function.
Initials for • Enter the program and verify the execution of the same on the
Attendance
computer.
Source program

Completion
for:

1)Source
Program

2) Program
Output

3) Program
Logic

4) Questions

Signature
for
completion

19
20
Output after execution

Explanation of program logic

QUESTIONS:

1) What is function prototype?


2) Explain the difference between global and local variables.
21
22
PROGRAM NO. 6

FUNCTION OVERLOADING IN C++

Date :
Aim : To study the overloading of functions in C++.
…… /… /… Problem statement

• Write a program in c++ to calculate the area of rectangle and


circle using the overloading of functions.
Initials for • Enter the program and verify the execution of the same on the
Attendance
computer.
Source program

Completion
for:

1)Source
Program

2) Program
Output

3) Program
Logic

4) Questions

Signature
for
completion

23
24
25
OUTPUT AFTER EXECUTION

EXPLANATION OF PROGRAM LOGIC

QUESTIONS:

1) What is the advantage of overloading of functions in C++?


2) State the features of overloaded functions.
26
Program no. 7

INTERCHANGE THE VARIABLES

Date :
AIM: To study the function calling methods.
…… /… /…
Problem statement

• Write a program in c++ to exchange the variables using the call by


Initials for reference method of calling functions.
Attendance
• Enter the program and verify the execution of the same on the
computer.

Source program

Completion
for:

1)Source
Program

2) Program
Output

3) Program
Logic

4) Questions

Signature
for
completion

27
28
29
OUTPUT AFTER EXECUTION

EXPLANATION OF PROGRAM LOGIC

QUESTIONS:

1) Explain the difference between call by value and call by reference method
of calling functions.
2) What is pointer in C++? Explain the operators related to that.

30
Program no. 8

FACTORIAL OF A NUMBER

Date :
Aim: To study the recursive function in C++ function.
…… /… /…

Problem statement

Write a program in c++ to calculate the factorial of a number using the


Initials for
Attendance recursive function.
Enter the program and verify the execution of the same on the
computer.

Source program

Completion
for:

1)Source
Program

2) Program
Output

3) Program
Logic

4) Questions

Signature
for
completion

31
32
33
OUTPUT AFTER EXECUTION

EXPLANATION OF PROGRAM LOGIC

QUESTIONS:

1) What are the constraints for the recursive functions?

2) When the recursive functions will execute infinitely


34
Program no. 9

SUM OF ARRAY ELEMENTS

Date :
Aim: To study the array and it’s access in C++.
…… /… /… Problem statement

• Write a program in c++ to calculate the sum of all elements


present in an array.
Initials for • Enter the program and verify the execution of the same on the
Attendance
computer.

Source program

Completion
for:

1)Source
Program

2) Program
Output

3) Program
Logic

4) Questions

Signature
for
completion

35
36
37
OUTPUT AFTER EXECUTION

EXPLANATION OF PROGRAM LOGIC

QUESTIONS:

1) What is array? How the elements are accessed in an array?

2) What is string? State the functions related to strings.

38
SECTION II
VISUAL BASIC
PROGRAMMING

39
40
Program no. 10

AREA OF CIRCLE

Date :
AIM: To study the event procedures related to command button
…… /… /… control.
PROBLEM STATEMENT

• Write a program in visual basic that calculates area of circle.


Initials for • Enter the program and verify the execution of the same on
Attendance
the computer.

PROGRAM CODE AND EVENT PROCEDURES

Private Sub cmdarea_Click()


Dim c As Double
c = 3.14 * Val(txtradius.Text) * Val(txtradius.Text)
MsgBox (c)

Completion End Sub


for:
Private Sub cmdexit_Click()
1)Program End
Code End Sub

2) Form
Design

3) Output

4) Questions

Signature
for
completion

41
FORM DESIGN

OUTPUT

QUESTIONS:

1) Why the Visual Basic programming is called as Event Driven


Programming? Explain it.
2) State the components of Visual Basic IDE.
42
Program no. 11

SUM OF NUMBERS USING LOOP

Date :
AIM: To study the iteration construct using do Loop.
…… /… /… PROBLEM STATEMENT

• Write a program in visual basic to find the sum of 100 numbers


entered using do loop.
Initials for • Enter the program and verify the execution of the same on the
Attendance
computer.

PROGRAM CODE AND EVENT PROCEDURES

Completion
for:

1)Program
Code

2)Form
Design

3)Output

3) Questions

Signature
for
completion

43
FORM DESIGN

OUTPUT

QUESTIONS:

1) What is iteration construct? Explain the do and for loop in Visual Basic.
2) Write the code for above problem using for loop.
44
Program no. 12

CALCULATOR APPLICATION

Date :
AIM : To design the application and learn the event procedures
…… /… /… forming the project.

PROBLEM STATEMENT

• Write and prepare a project in visual basic to design the


Initials for calculator for basic operations.
Attendance
• Enter the program and verify the execution of the same on the
computer.

PROGRAM CODE AND EVENT PROCEDURES

Completion
for:

1)Program
Code

2)Form
Design

3)Output

3) Questions

Signature
for
completion

45
FORM DESIGN

OUTPUT

QUESTIONS:

1) What is the implicit and explicit declaration in Visual Basic?


2) State the basic data types used in Visual Basic programs.
46

You might also like