C++ Exp 1a To 1d
C++ Exp 1a To 1d
PAGE 1
CS22203 - OBJECT ORIENTED PROGRAMMING
IT22111 – PROGRAMMING FOR PROBLEM SOLVING LABORATORY
EX NO : 1 b)
EX.NO:1
DATE :
DATE: 9-10-2023
PROGRAMS USING FUNCTIONS
DATE :
PROGRAMS USING FUNCTIONS
RESULT :
Thus the C++ Program " Implementation of Call by Value, Call by Address and Call by
Reference " is executed and the output is verified successfully
PAGE 1
REGISTRATION NUMBER : 2127240501077 PAGE 5
CS22203 - OBJECT ORIENTED PROGRAMMING
IT22111 – PROGRAMMING FOR PROBLEM SOLVING LABORATORY
EX NO : 1 c)
EX.NO:1
DATE :
DATE: 9-10-2023
PROGRAMS USING FUNCTIONS
You are developing a 3D modeling application that allows users to calculate the
volume of various AND
COMMANDS shapes, including
THEIR rectangular boxes. To make the calculation
DESCRIPTION:
process easier for users, the system should automatically use default dimensions
for a box1.if Description:
the user does not provide
Creating specific values for its length, width, and
a directory
height. Command: $mkdir ppsl147
SAMPLE4.INPUT
Description: List all files
AND OUTPUT : & directories in present working directory
Command: $ls
[cs24b077@cslinux ~]$ vi 1c.cpp
Output: ~]$
[cs24b077@cslinux ex1 c++ 1c.cpp
[cs24b077@cslinux ~]$ ./a.out
5. Description:
Volume with Returning
default values: 100 to home directory
Voume with Command: $cd .. 19
user value (8,6,4)
6. Description: Create new file
Command: $ cat >f1
Output: this is sidharth
^c
You are developing a program for a financial application where the system needs to
COMMANDS
perform AND THEIR The
division calculations. DESCRIPTION:
program will divide two numbers, but in some
cases, the user might not provide the second number. If the second number is not
1. the
provided, Description: Creatingdefault
system should a directory
to dividing by 1 to avoid errors.
Command: $mkdir ppsl147
Your task is to write a C++ program where a function takes pointers to modify the
2. Description: Changing directory
values of the numbers.
Command: $cd ppsl147
If the user
3. provides both
Description: numbers,
Find the function
Present Working should divide them. However, if the
Directory
second number is not$pwd
Command: provided, the function should default to using 1 as the divisor.
Output: /home/cs23c/cs23c147/ppsl147
Write a C++ function that performs the division operation with the flexibility to
handle a4.default value for
Description: Listthe second
all files numberinusing
& directories presentpointers.
working directory
Command: $ls
AIM : Output: ex1
To write a C++ program that performs division using call by address and default
5. Description: Returning to home directory
arguments, ensuring that if the second number is not provided, it defaults to 1.
Command: $cd ..
ALGORITHM :
ALGORITHM6. Description:
: Create new file
1. Start Command: $ cat >f1
Output: this is sidharth
2. Input an integer a.
^c
3. Ask the
7. user if they want
Description: Viewtofile
enter a second value (b).
Command: $cat f1
4. If "yes", input b; otherwise, set b = 1.
Output: this is sidharth
5. In the divide() function:
8. Description: Appending content to existing file
6. If b == 0,Command:
set b = 1 to$cat >>f1
avoid division by zero.
Output: I am a cs student
7. Compute c = a / b. ^z
[1]+stopped cat>>f1
8. Print the result.
REGISTRATION NUMBER: 2127230501082 1|Page
9. End
SAMPLE
AIM: INPUT AND OUTPUT :
[cs24b077@cslinux ~]$ ./a.out
EnterCOMMANDS
the value of a:10
AND THEIR DESCRIPTION:
Do you want to enter the second value:(yes/no)yes
1. Description: Creating a directory
Enter the value of b:2 $mkdir ppsl147
Command:
The divided value is:5
2. Description: Changing directory
Command: $cd ppsl147
PAGE 1
REGISTRATION NUMBER : 2127240501077 PAGE 10