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

C Assignment

Uploaded by

Div Swag
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

C Assignment

Uploaded by

Div Swag
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

OOPS ALsngnmont

Naume Abhunau Tyag


Cowde B Tech (CsE
Soc oll mo A/o1

Cue1# inlade iosbam>


udtng namsoace Std,
cRoss bonk
uvote
Stag moe
S+ oodhey,
it AccNo
float bo launte,
Pwblic
Stahic t C,

s
Veid

thid
st (Shu
nam
Oddojeas
hame,Stulnq Qodbass, lot bo.aunce
mome
= Odldbus,
hid- Acc No= C
his- bolante = balonce,

Veid
upla)
Cut C CmomeLled;
Nane
Coud2 dds:C2 addhasg <ed
Coudt 2A cteut No "CAcNo4<end
Csut bolonce '(bolonte end;
Vaid Depoadflet dep
.lboncet= dep,

VEio lthdnoufloat uith)


bolomce- wuthd
Veid ChangeAddr(StiOdd)
addaeu addy,

int bomk:1 C lool,

aiv)
Siughome,0ddhuss
Ploat bonte
Caut2e6ter mo.odapecbe

omk el
rt Cadt
Clm

ob
,
ieo; iim;it+)
Ce ter
mome
Noame, Aldlhauy
) addnoAs) bolaunte

Set roune, oddruss, balonte)


6alone ondl;

uhile (yr "


CouctC2et he dapoatoy
CAn 3 eto the
Cudt 2" chsice
Ctn ch,
Stwteh (ch)
Cas olL 1.Deau (sSoo),
CaAo 2 oiL).uwhdaad Soo),
ou Cj). displaa)
Ca8e. 3 obiC3.Chogehddy ("Sonnbhal")
obCa.dusploy
CaA U ab td.dicplau)
Cole 5
ek,
extt (o),
4imude iouinam
LAng mamiapoce Sto

ue Clau Studat
Prvate
Skung owme

it ml,wml, w;
ivt
peutog
Public
veid TnpdInfo Stai Mamb, itKallo,int md,
As
it,t m3)
+hi's-
oune ane
Kollho Rell mo;
his hl=m;
his m m
thuS ms m5;
chay

,
Cale Vencetage(

Hoat t
(nl42tm3)/3,
entutasg
o)
YctuwinF
else if (t 260)
rtuun D
else f2 B0)
YcbuomC
elseit90)
yetun' b
else
T n A:
Veid DchoyTnfo()
Cht2 Noae"<namee Cendl
Cau "Lolle fots exdl;
Cuk C fecbae Cpotoag, C2edl
Int moun O
Stuudent S d
dalt

90, 1S
S Jnpat Tno "Pahul", 45, lo0,

Cout2e s.alefeneastage() edl

Claa a doloneo dato ub uwhvch helds ris o


on be
be
olata mumbens anclmember funchiod whsch
ce&A.ac Qnd ud by Cousthg On uone o ot clous

wh
ti8 bluePoi.t for an olect. EXClass of CoMs

ull
uull Shone Conmm puepotbies ke wheal,
speed.int
miaqe Yoge to
Dato nembenl OUe dodto vanuoble.s Ond manbey nctiov
one funmchond usad to mani pulate haa Vouobles Ond
Atogthe thuo olons bect m cHoss
behawnoy co
A aet e tonte of claus.hun a closs is depined
no vnamoy ollocated but whon ig mstohata
memehy 18 allocoded

Keguordr Udordlemed mame


Class clo&s Naume

Acce&s Speciker /Cam be ivote, Public frolected

Doto membe8, Vooble to be udsd


Member
wnchovd) melkod to OcceLs dkta.pmb
oyrome eno wuth Semicolom
Conttructor Al Wed to mhialize the okject ef clou wuhile
clustruetr is calles mpilor when objeet clestroyed

Cornutructor i o shecial mtmmber fun cass and Shanes


e 8ome mame a o ads, t 13 Called Cmpior uhunever
the objett of claus sk (eated, tallecotes mamey o
he
ebyet und mihalize clas olato mamber by dejau Values.
ko tla Noune
uvate
/Puvate mumbrs
ubhie
tlasMame({fanaumactus})
lCewsbuctoV bedy

yes Cestutor
Delaut Conttrutor
ts 2eo-oaumat Cedtucter, 08 1t closnt tokeon 4
nantO
inde <iostneom
LAg omespoate Stdl,
claLs felen
Juvote
Sbua ome
public:

Cout 2 Defauwlt Codnueter alledtndl,


name Shudot"
OR 12-,

Veil diphy(
Cot Nane ouwrent eb2raneondl;
Coudt Age etunrut ob og04 tnd
mt main)
leuon 0by

olj.ousployO;
Jetuw O

faamateritol Coututtor
dad to inholie dato mombeys uth Valued fio Wo
AAA Lous Noumt
uvote
Iruvate mumbers
Publie
tWoAyNaume Ponamtul,
fonanmitun

Cowkthuutr bedy

Cemtuctor
We wa to uuote Copy
Same
Jo4s SIMmed dgtloned
otject8 Nos them ebu Cnnuter Called
claLs los Noame
ouivate
/uivote manmbes
Publie

tlaAs Noume Cot clous Noame o


Constuctoy ady
Atubructor d called
tompilr whon object is dautoyed
d its mmain
fun i to oleallocate the
mtmsng ol objet.
nolix lde () 8 wad ad tat be avonleaded

ruvate
vate munnbes
publie
Nlatlname
Idustnuetur Aad

ue5n Ct+,we Ca have moe dhon ne tbutoy m o Woa!


LTh
wth Sowme rome 0ud
ng a dlferut lis+ cwrqurols
t 1s CA3ohally aethe Some moaume and olffeut y he
wwmbens Cndpe Oungumas
R Costbuetor iCalle depo-dirg, uper moud Ape
ngumant PoLed
6K ass otnuwet
Publc:

Ceatuet)
OnRa0,

Consbruet(imt a, it )
Cat Ona C endl
t
main)
stuc0
owstut 02( to, 10);
O ouispkay)
02- ousb

Ytuyn 0;

Duetput
200

duatnucy Cot be ouenlaaded, Since a doutaucty


does n't take

Gue6 C os he
perol mtanivg foy
au3
e
ovngumsnts

obrlit,

dota
ober vealsodira.
a
to Pevide

E: we Con velcod
he
pes,this
cpeotsss
abil
t
Krsuur
a

Cen&otenade Sthina Ond it


erpile hme
P phism.t ves sbeiol maonisng to onexisti
peatoy m C+ wthet chonam nisinamerimg
oeratorS hai Con be
Uo cperutor
velcoded
(+,-,++, --)
,io spenatoyr

Spciol opeuter
(4,-,*,I,7)

ome operotiafS Cant be Ovnleaoded as:


3iteel
type id
)Stspe YesoQdion
ple tincole 1onam
LLgmamespate Stdl

closs Cnplex
Pivateint Naol j
public:
lv-plex (it
+his-Yealfeol,
real, it mog )
's-ivvag 1ma9
veld phit()
CotCYeal <+l CnOg
emplex penotor+Comnplex C2)
Cevpex c3(0,o),
c3. Yeol his->Yeal +C2 Yeal,
3.lagq= his- imagt C21wa
rebun C3,

t man)
Ci (3,5);
Cevnplex

Covmplex c2(2, 1):


Cemblex C3- C+C2,
C3Pit );
Juton 0,

Okhut
5 39
e4 intndJe 20seom in
lng namaspace sto,
Stdl,
Cas Cernplex t
Phivote
ivt
nuol,im
ublic
Complex (it eole0,
hic reol=Yeal
g- o)

his- Im

Cervnplex openochr+(Covmplex & C2)f


Corvmplexemp
tenp Yeal-real + C2 Teal,
tem m9 Im C2 1mg
Tthun denp

Conplex operotsr-Comb lex c2)


Cewplextem
=
tem. Teal realc2.real:

Tetuntemp
Vool
obspla)
"+ i(Kng ")tondl,
)
Couct 2Yeal

ain
Cl (6,5),
c2 (,9
Cev.plex
Cmplex t c+C2,
ou's po
t CLc Oustput:
uisla H(4)
tunn 0, -2 ti)
MAde Citabsv
Lt ovntspce Stod
tlous ef
Phivate
t hen, min, Sec
Puublte
time int hawn, t miin, inct Sec )
s hsw heuw
S-mn
hs- Sec
min
Sec

Vtiol ofenatar ++
Sec++
(Sec=Go)
Set0,
min+t
-(mins=6o)
min=0
hen
FCkoun
+
==24)
houn-o,mo, Sec 0,
void
dislay
Cout e2Te ko eonine Lsec.

Imt mam
hime2259,59 Cutpret
dsplay Time12:S3:59
Tivne23:0 o
cuislay;
we9 mlule iatream
MBAamamas0ate Stol
claus tihelef
Phivate
it aduw,

Pubbe:
Cincle (it (adis2o)
ORo 3-14 roduusVads,

beo cfeatey<(cihle Lce)

YetunnOUA C2 Usa

htmam)
Chele th9), c2(9),
beo Cl cc2,
,#inude Crodam
1o ng Cn
do
naimaspose
plex

ruvott
Std
Std

puv t ol,moi
pubhie:
Cormplext ralo,t o)
Hhs-Yta real:
his- ing ng
Lplex cfeoute t(Colex
Lc )f
Cermlex dtmp
temp.reol=Teal
ca.Yeal
enn C2-
c2-1 ima
Tetun temP
aperattr= Ceblexea)
lTeal C2-rel )
feton

else

Yeton Net eal

veel duspla
CouctLreal
+i(img2)'d
It main )
Cerne ples
ct (7,5),c2(8,9
Comblex t-ac2
ou'spla)
t Cl-c2
tdispla O;
Caut (cl=-c2) cendl,
netn O,

You might also like