Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
43 views

C Programming2

This document discusses object-oriented programming concepts like objects, classes, abstract classes, methods, and data structures. Objects represent real-world entities and are instances of classes, which define common properties and behaviors. Classes can be abstract, providing method declarations but not implementations. Methods represent actions objects can perform. Data structures like stacks are used to store object data.

Uploaded by

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

C Programming2

This document discusses object-oriented programming concepts like objects, classes, abstract classes, methods, and data structures. Objects represent real-world entities and are instances of classes, which define common properties and behaviors. Classes can be abstract, providing method declarations but not implementations. Methods represent actions objects can perform. Data structures like stacks are used to store object data.

Uploaded by

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

ng’ A Jotge nuomy ct choncto called

Stoing' s cxitten umde. doble


gionon moot9.
c is a JencHon tosa angange

chxks Bitege is xgtded "Fther Gnbetr!


Tips opeatins in sting reng
`ting Decaatin 2 nitializotn.
Shing Tnht
Stoing Moniudotin
Moctncdical' Egpatin e chactas.
Shong DecJaetion ritalizalon:- Je. tras tat
a gting
Vogiods decle by telþ f dat te 'ctox
chr2ome tng
. chor
vite aha;
is a tey cerd.
chor nnl6];
Sing Inþt:-(ing sting that n C mamno
oviding intamation to wsoY in the.
toom a gtng? The tenctin gony) with the
Oaegs fecies 3 Con te sed to ete a
inbt in CC withad sce. To Johe a stong
inC toith staces, dhe hing nput
gets) gek) ollaamg metods are wsed
ing ardhdi de com pird a sing in Cuing
ut), fin) ter ogp ond racçsiOn
medhad-e hae to pos a stng
Chaocta
frort te gting in the Conoe
ovgomt to
Ci tuds (< sting vicbe >);

stiny in Cis merey


Stong Momibdason- Aony chactas. The inghi
nl! chrelar So
by o terimling
detamined
Chaacds la), fs ond the tamasty ([
Chaacta,
Matmatial Eguaten d°t
Descoiption
Funcion dangth a
shlen() Con compcr the
She stg.
Stoy ()Con cobA the co the codent
a stig to amcthes.
Sthcto
jan to stings.
Stsorp) Con aonae tuo sting.

Carivat the letes


stong toors.
She) gt coad o yesse the stins
. pets() onad gets) The to tuba
enelions,
headex yib gts
and
Both o thse ae defned inphm
# Jncleidegthot
int ln=0,czl
vod mam [)

geds(9;
he-14-o& 223

sdatamens
Fncin A enin is o gaup bef callad ttom
jn o onm thot com
in
Aencion tos a ca
defmed uafose and on indoce to ate doncens
Jom aa boyger enliky called a modda
A anckin must te dtind bifae jt
Cm be usal. The gencal Jesm ofa tenchion
cmitin js;
The fncdenS orn( tuometr list)
3.

Caling kccn
Art maim (yod) Coull Jenelen

add)

3
he t t thé Somple togom dce, cc ie:
Caliny denctin ald()
Intt to0 Tmbs

The am e the eo nanbe is o


Axeton foorn aed () 4mction.
In the hogom deeo. cc, he Juncdion mam CO, 'hich
invokes the Jemcten add), js aalled the
callnginctin.
Jemctin. o the emctien dd C) js the alled
"Hhe incluaion o a denction jn
veguiss threc Comhoents. ry vogoTm
he ynctim decoatin x
Calls to the teneirn. fotoying
Functon deiton.
8 funcion3 toymg- Just Voriobls declird
jt s nece30r to declore. oor
mpom the conblo thod the pioobybe a yancon o
emchon 6ocsud be ot
fnclin pokyng
ihe JencionS tith
orabks ach cse
heotctye odetemino heet
he fonctio in nyoked. tohaly
et s he
ernas aye cley fume
he, ogom, as
uncdion deckorion the rome
the rqumerds

yalame, (intA,
eatB,Jontc; Senycale
Fndia
Nome
n ernd.
mud
Float
e dhierak
Vourtdle
sdeset oCthe con
Yalie that
the xetr
tm.t may e
Fnctin Rotobys Aaantagg .
Enctian Botoryo qatly rcsace the chonos

"The tom corety mdo the demcJen ekin


Value.
"the ogm checks that yu 8- Ue the corect aumer
Jemcas evgement.
" The ogzom cheds ht yu use the conec tys
arqiments, t not, jt cmt agumet o he coeot
tyfe,s fosbe.
. also dhets he soquencc's avinents.

Rorber of agpmets. fox insHene atose


he olbung oll:

fumcon toith o Rekeamvale.+ Aencion


toying
vetrn alue. þooducs
a valoie hot con te
agrigne so a
jndne , the sonkd CH liyaoiple. Fy
Joncten caled
Fenctions itaihet
Furctos that etm ales ae temd Jolloung
tye void Junctons ond toe the
gmgal.
oid fnctiTvne(agmert-list)
stotenert

ts o etn alue, end the empty

Fncton Sn:
Nod ran()

Noid od j*-Stmj olorn.


functin decbxn
anctn Cal

3
'Vaid add)
No Soynicalon.

Fncan Fmcton
Eody pefiniten.

No Stnicola n
forcdn Camkeents
Comprent Eomle.
Decolien ecijis emcton Temc
Lfattye) ycten yolue
Aleds crilx ord
Progome tot ncdon
(oaldi yme bta in
the bogorn.
add);
Cal Cause the cha t
te excutel
Denitin yaid adl J;
he ines ode hat
Consituse she encian.
Fnt ie e demuo

faaing, Agymgnts fmckms- Argumats (s) o} a


dala that te Auncion js(a) he
semcion yeceno hom coled 4m
Fsgerments albo a
tuth difoent vokes, ih tueenctong to chexate
coþuted cu ide. he teen acepded a
dre on the ncin, epeh
requiremends he fogn ding an
fasng Constt:- A encn, comet moijy
Constort obue to tte Jencha, n the ncon sa
imable to malily the yale r as he yelue qYe conslo
for ompl:
Jmylh( NT LH'):
The yalue Canot te malid n he aboe orgermazte
it is a conset yalue.
Caling fmchicns- oo yau ate Jorniliy cith malng
-encsn clls, mam() cale; the te
vaid yencion Cany ad) by ing the
and ncen Tome
Phis is an erombe a kncton coU statementB
( a

dobe Sen=
Qdd( rurm ton);
Let date a coses ootk at
An Ctt rogm. Jenctions htonchopave arcpmerts.
gumero n be
Yole

Cal by Vabe mthe cal t value mtha


the. colted emcian cçata ps
eioblso te the yolue the agemeydsod soit ort
Cyrgne
numeyical
Jo
yolue o he ync}on, cteye t
a hes e h
his 'me oobies he olaec actel

n the fencon delinidon he Jomal'


tindas) _je te mon cete is an

detble.
valys Js -Caleo a oyma
-patomelas.
The velae tosal to tre yoen is

igmrt a efone to the kiaole


ootiral yasoble
meon the 8one eAe
Sleoge ya. )
Fhe ploig slalmot ckye aveyane vxidbte

X
incladedonio-h>
Void gum(0;
yod ren)

chex0;
3

(nrde the nunber


fmt
Sortt sa,9b);
rinyl ",c);
3.
+ Jnoede2conioh>
# 0nchacs tiot>
(inta, itel,
Vod maln()

bint"erte theno) ;
9cont %e , 94)
|lC= gun(0, b)

3 Suninta, rtb).
int

3
Sem tonanbeng csng tnctn
+inclune stiot
)nladeKConjot L
int oodnnda);

Yojd marn()
2
#icade<stioh>
, Jrtb);

Nod man(1
Cosca);
binl'ntu he opumr: );
Sor(drd a, 2bl;
gedeh);
3
od gaptito, irtb).

b=T;
fint'n b=eo, b);
3
Jar;
Jaot inomelr(eato);ioy=o,
3

3
e-24-08-)3

Pasic- Chect-Oderd
Snstodeconmto cbject ogted fogmvmy
ist se in
asobems
oge posgoms being deelobs in
Comato
albus ote.
or the Chertented toogrmmy
oppiogdon thein tons entis or chects
rbcat he toron
cosy boshle.
Data: Fen:
emploges Colcolate sabry
Saany statonents
Billg
Vouchexs Taly acounts
Recidts Tonsact oth
Bonts.
Bonting Dato
Dota and )
Obyccts o hirg
An cbet js o Concept that is tebvont
boebica
lotdh delieddoalirg Goth.
Abbom
Chyct
Hhe oouik aftcal
ocical agis Jar o Compte

Classs
Clos3 Acos is a godÙng chect tot
toe the Jore fropextis, Corryon betocut
ono Comn¡n xeltngis.
Each cbiect js said tobe on jnasomce jds ca
Ja Comblo3, n o clas c esians, hecihc inaiyiavsb
S0y, me Jack, Joe, etE are the chyecs. 3n
pvallel. ogom a xectonge ond go an, ye
chych.

vetis
Boner cobg
Abstact
Meltods:

Ohjccts ondclgs
on ohject cx entiy
ohm reesnted in a cless js caled aa
trchety.

ertity hem xebreserted in a


Called a met.
Eoch octicn vequired on cbyed e
ertsy wba rcomg a Jenton jn the
a medhod. In
3n the oygon clas
O'oe
moye
t e cas,medhads h aye
ne
omtars stackae stuctwe..A to mik vesy
ohyect -oi
on oeme Jomgage as
ended
tee dataSctre:-The
cls and Ca8s
cas. dillat dilaoton Clage
Bhy teae
n snc the bymat
endods ti am felyrothism-
cag. nas
ometnm
thad frs Encabsahtion
the ss Encahaulation-
dl clas. mew a
tocas custng on euge he
loss hat poopesty the rnheatomce
is nhaite-
vat endiosty pudocsbr atplcatim. the
oebttoed mets.
shg monz docbpnet,
his yston cblen.n
abects cestan
exomng
Chas usadelnco namcZ

dah-yfe

rnplmenesian ofaaks;
3.

Sactye

Yoid bint-ote (Cmst sate


clas date
int

folode ond Rblic sectons ach-


Class ment
decbred in he pbac he pite te
sectioro aacbo.
Prnt
cag Qre nono.dseci thendato
he
he dodo merbars ard edion decd hy n
hbc con, Con te ocdby ong Jnjon n Hhe
iosb(oatk ciag).
Clage
Pivate
Not oceatbt foam cckk ch
Fumcons

-faressibk om outit cler


Fncioy

Manyes funchn Amsge teto on ohjed


Cosgboto a tencon al.
MeBoge con hove omesa.
In ctt, a yrcion dechye 3 a mermber
too oncn in te clas. chte shoon otoyo.
yod mn0

C=ath)
cot <<Total
3.
Cargoe
25+5
Toal=3o;
#nclue<jotomt dote
Clasgincudekconi
te o-h>
Caceoex the jog dk
vod inpoth glehco'
void dispay0;
yoid dte: disbay )
cutd<e<m<uey
+inclode kiostrem h>
clags dot.
pivete.:
Pdic:
void input ();
vol dipby0;
3;
Void date:: input ()*
cout e ueto the yeor month doy:'? ;
Cin>>dm;
void date::dikbloy ()
Cout d<c«'m<Ky
Yoid main ()
chxso),
Dote-o&l/p.2
#incle< hona
Clas tent

Jnt n
)
chor nme21de'

void
Void
inbud):
Voi
3:
vod stdert::inkut)
Tome xolno thee gb
Cn>rome>n;
aj=0; J=2; JtH)
matm'

J.
Void slatnt: catulalel0

You might also like