OOP P1 (270 - Varun Behere)
OOP P1 (270 - Varun Behere)
OOP P1 (270 - Varun Behere)
Oiented Programming
Using C
Object
Practical Significance:
oI constants and variables facilitates the evaluation of
. The declaration
arithmetic expressions in real life problems.
The data type conversion helps in real life problems to get the accurate results
2.
arthmetic expressions.
of evaluation of
Practical skills
Competency and
is expected to develop the following skills in you
This practical
Develop C++ programs to solve broad-based problems
. Define and declare constants and variables.
2. Use data type conversion.
3. Compile the program.
4. Debug and execute the program.
output on a console.
Standard input stream (cin)
istream class.
The cin is a predefined object of a keyboard.
is usually
It is connected with the standard input device, which to read the input
with stream extraction operator (>>)
The cin is used in conjunction
from a console.
execution of a program
change its value during
Constants: A variable which does not value of a constant will
constant variable. Any attempt to change the
Is known as a data types,
constant in C++ can be
of any of the basic
result in an error message.
A
shown below:
const qualifier can be
used to declare constant as
expression,
Explicit conversion: It is also called type casting. It temporarily changes a
variable data type from its declared data type to a new one.
IX Precautions
. Handle computer system and peripherals with care.
2 Follow safety practices.
X Resources used
S. No Name of Resource Specificati
Computer System Tnlel core 3 Rom: 4r
with broad specifications
HO: 4T8.
Software Turbo C
Any other resource used
Ta
T. a= 1
num c a tbt -b
Output
a
cout <K c;
7
7-S
3 Regarding following statement which of the statements is tnuc? const int
a) Declares a variable a with 100 as its initial value
a =
100;
b) Declares a construction a with 100 as its initial
value c) Declares a constant a whose value will be
100
d Constructs an integer type variable with a as identifier and 100 as value
XIII Exercisee
12.SC636
clrscr ();
float res
HHere F 2 remans
float fl=15.5, f2=2
res (int)f1/ (int) f2; as 's is not
Outisres<<endl;
res= (int) (f1/f2) ;: COnven fed in to in4
coutikres<<endl;
res = f1/f2;
cout<<res;
getch ();
Otreom.ks..
S22..inctude........... ... ***********
. ncluude.k.co.ni.a.h...
*****.
****'****** incuu.de..math.:h...
*********
**°*
*******'******
**************.
tlaat..a....%3.2ecre.men.enk....A
co.tK Ente... Coefh.c.ien
pa.t..patt
****************. . i . n . . . . 2 . . . . ,.. **'*****
********"
...sCriminant.. A....
****'*
********'**
*** ***
'*
cisCr.iminant..a)..
'*** **
**
** *************".
**
***''*
'***************
'*"
***************** ******.
3..us.ctiminon{.f.s.2*:a.)..
**'******
***'****** :***'****'****
qa...C.disc.iminanAt.)..f.C.2.*.a.)..
****************'***************** ******* '
0ut.KS..Roo.ks..ane..ARa...dffenend...kKend.1.,
****"**
******'***
******* **
*************'*
**
..Cout.K...A
**** k.Aq.SK.eadl. E2ksnd.. ***'*
*** ** ******************
*** *********.
..As.e..f... sCi.minant. )....
.... ..... *********** ** **********
...CoLtKs..0oS..Oe.Complex...k.dtffenenKAd.
.Cout.ss .par.t.. .i.pat.k. ond S
*****CoCut..a .A03.t.KS. .patsk.Ksnd !s
.Lutp.at. te...coetfictent. ..
***** *************** .Roo . Ra). .dffenen.. ***** *************
*********
*****************. . . . . . O.2S
. . A g E********** *** *** ** *** .*. ****************** ********.
**********
.M.O.d..Ma'nc2.. * ********* ******** ********* *************************
* * * *
e..Cath)....d..
******************COut.Kk.alue..atb)..C.Ld... Ke.KendL
******** ********e. a.b..C.L.d.)..
..0.tSS.alue.....th.d.*I.d.S..K.eSKend.
***************
********** ***T.
ala .L.hc)./al.s..eK.end..
*************
e *
0tek. d).. ****'*************'***'** *********************** ******
********** ***
****************
*********************
'************************************************************************
*************
**********************
...alue...C.At. .L.d.. .0. ********* * ****
********'**"*** ****
a.lu... ..
.Ca.t.b.).X.C.CLd. .
************'''*****
*******
**
****.
XV Assessment Scheme
2.
Dated signature
Marks Obtained
of Teacher
Process Product
Total(50)
Related(35) Related(15)