Date post: | 14-Apr-2018 |
Category: |
Documents |
Upload: | neeraj-soni |
View: | 218 times |
Download: | 0 times |
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 1/80
A
PROJECT REPORT
ON
BANKING SYSTEM
SUBMITTED TOKURUKSHETRA UNIVERSITY, KURUKSHETRA
(IN PARTIAL FULFILLMENT OF THE REQUIREMENT
FOR THE )
B.Com II
IN
COMPUTER (VOCATIONAL)
UNDER THE SUPERVISION OF: SUBMITTED BY:
MS. SAKSHI ARORA PREETI
DEPTT. OF COMPUTER VOCATIONAL ROLL NO.: ..............
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 2/80
T O W H O M I T M A Y C O N C E R N
T h i s i s t o c e r t i f y t h a t M s . S a p n a i s a b o n a f i d e s t u d e n t o f
c l a s s “ M . S c . I V ( I n f o r m a t i o n T e c h n o l o g y ) R o l l
N o 1 1 2 0 9 0 0 0 0 7 4 o f t h i s c o l l e g e f o r t h e s e s s i o n 2 0 0 1 1 - 1 3 .
S he c o m pl e t ed t h e p r oj e c t r ep o rt e n t i t l ed “ L ab o r at o r y
M a n u a l ” . I w i s h h e r a l l t h e s u c c e s s f o r t h e f u t u r e .
L e c t . D i r e c t o r
M i s s N e e t u M r . Y a s h v i n d e r
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 3/80
CONTENTS
1 . P r e f a c e
2 . A c k n o w l e d g e m e n t
3 . I n t r o d u c t i o n to So f tw a r e ( C )
4 . S ys te m I nv es t i ga t i on ( Ab ou t T op ic )
5 . S y s t e m A n a l y s i s
6 . S y s t e m D e s i g n
7 . P r o g r a m s
8 . O u t p u t s
9 . A d v a n t a g e
1 0 . F u t u r e Sc o p e
11. Bibliography
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 4/80
PREFACE
A c c o r d i n g t o P u n j a b T e c h n i c a l U n i v er s i t y i t i s m u s t f o r e v e r y
s t u de n t o f M . S c I V S e m ( I n f o r m a ti o n T e c h n ol o g y) t o s u b mi t
t h e p r o j e c t r e p o r t o n A d v a n c e d J a v a . I h a v e c o m p l e t e d t h e
p r o j e c t r e p o r t o n “ L a b o r a t o r y M a n u a l ” b y g e t t i n g t h e
g u i d a n c e o f o u r c o l l e g e c o m p u t e r d e p a r t m e n t t e a c h e r s . W h a t I
h a v e d o n e i n t h i s p r o j e c t i s s u b m i t t e d i n t h e f o l l o w i n g p a g e s .
S a p n a
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 5/80
ACKNOWLEDGEMENT
I w ou ld l ik e t o e xp re ss d ee p s en se o f g ra t i tu de t o “ Mi ss
N e e t u ” , I n f o r m a t i o n T e c h n o l o g y f o r t h e i r k i n d e n c o u r a g e m e n t
a n d c o o p e r a t i o n .
A t l e a s t , b u t n o t t h e l e a s t I w o u l d l i k e t o e x p r e s s m y h e a r t f u l
t h a n k s t o m y t r a i n i n g f e l l o w s f o r c o o p e r a t i o n .
F i n a l l y , I w o u l d l i k e t o t h a n k m y p a r e n t s , f r i e n d s w h o h e l p &
e n c o u r a g e m e a t e v e r y s t a g e o f m y r e p o r t w o r k .
S a p n a
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 6/80
INTRODUCTION TO SOFTWARE (C)
C b eg a n i t s l if e a t B e ll L ab s, w h e r e B ja r ne S tr ou s t ru p
d e v e l o p t h e l a n g u a g e i n t h e e a r l y 1 9 8 0 s . I n h i s o w n w o r d s ,
“ C w a s p r i m a r i l y d e s i g n e d s o t h a t t h e a u t h o r a n d h i s f r i e n d
w ou ld n ot h av e t o p ro gr am i n a ss em bl er , C , o r v ar io us
m o d e r n h i g h e r l e v e l l a n g u a g e s . I t s m a i n p u r p o s e i s t o m a k e
w ri t i ng g oo d p ro gr am s e as ie r a nd m or e p le as an t f or t he
i n d i v i d u a l p r o g r a m m e r . ” S t r o u s t r u p b a s e d C + + o n C b e c a u s e
o f C ’ s b r ev i t y , i t s s u it a bi l i t y t o s y st e m p ro g ra m mi n g, i t s
w id es pr ea d a va il ab i l i t y , a nd i ts c lo se t ie s t o t he U NI X
o p e r a t i n g s y s t e m . C ’ s O O P a s p e c t w a s i n s p i r e d b y a c o m p u t e r
s i m ul a t io n l a n gu a g e c a l le d S i m u la 6 7 . S t r o us t r up a d d ed O O P
f e a t u r e t o C w i t h o u t s i g n i f i ca n t l y c h a n g i n g t h e C c o m p o n e n t.
T h u s C i s a s u pe r s e t o f C , m e a n i n g th a t a n y v a l i d C pr o g r a m
i s a v a l i d C + + p r o g r a m , t o o . T h e r e a r e s o m e m i n o r
d is c re pa n ci e s b u t n o th i ng c r uc i al , . C + + p r o gr a ms c a n u s e
e xi s t i ng C s o ft w ar e l ib r ar i es . L ib r ar i es a r e c o l l ec t io n s o f
p r o g r a m m i n g m o d u l e s t h a t y o u c a n c a l l u p f r o m a p r o g r a m .
T h e y p r o v i d e p r o v e n s o l u t i o n s t o m a n y c o m m o n
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 7/80
p r o g r a m m i n g p r o b l e m s , t h u s s a v i n g y o u m u c h t i m e a n d e f f o r t .
T h i s h a s h e l p e d t h e s p r e a d o f C .
T h e n a m e C c o m e s f r o m t h e C i n c r e m e n t o p e r a t o r w h i ch a d d 1
t o t h e v a l ue o f a v a r ia b l e . T h e n a m e C c o r re c t ly s u g ge s t s a n
a u g m e n t e d v e r s i o n o f C .
A c o m p u t e r p r o g r a m t r a n s l a t e s a r e a l - l i f e p r o b l e m t o a s e r i e s
o f a c t i o ns t o b e t a k en b y a c o m p u t er . W h i l e t h e O O P a s p e ct
o f C + + g i ve s t h e l an g u ag e t h e a bi l i ty t o r e la t e t o c on c e pt s
i n v o l v e d i n t h e p r o b l e m , t h e C p a r t o f C + + g i v e s t h e l a n g u a g e
t h e a b i l i t y t o g e t c l o s e t o t h e h a r d w a r e . T h i s c o m b i n a t i o n o f
a bi l i t i es a ls o h as h el pe d t he s pr ea d o f C ++ . I t m ay a ls o
i n v o l v e a m e n t a l s h i f t o f g e a r s a s y o u t u r n f r o m o n e a s p e c t o f
a p r o g r a m t o a n o t h e r .
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 8/80
INTRODUCTION TO TOPIC
SYSTEM INVESTIGATION
T h i s p r o j e c t “ B a n k i n g S y s t e m ” h a s b e e n d o n e t o r e p l a c e t h e
p r e s e n t m e t h o d ( m a n u a l ) o f B a n k i n g . T o i n c r e a s e t h e
e ff i c ie nc y i n h an dl in g d a t a a nd t o m in im iz e t he p os s i bl e
e r r o r s , t h i s p r o j e c t h a s b e e n d o n e w i t h g r e a t c a r e .
T h e B a n k i s r u n n i n g a b r a n c h i n V i l l a g e a n d m a i n t a i n i n g a
d a i l y r e g i s t e r t o m a i n t a i n A c c o u n t s a n d D a i l y T r a n s a c t i o ns o f
t h e b a n k . T h e d a i l y t r a n s a c t i o n o f t h e b a n k i s i n c r e a s i n g d a y
b y d a y . T h o u g h t h e b a n k h a s g o o d r e p u t a t i o n i n t h e m a r k e t
a n d k n o w n f or i ts g oo d s er vi ce s a n d w a nt s t o g iv e i ts
c u s t o m e r s b e t t e r s e r v i c e . A t p r e s e n t t h e b a n k h a v e 5 w o r k e r s
o u t o f w h i c h 2 a r e f o r m a i n t a i n i n g d a i l y r e c o r d s a n d
a c c ou n t s. T h i s S o f t w ar e h e l ps t h e b a n k e m p lo y ee s t o r e d uc e
t h e m a n p o w e r i n t h e a c c o u n t s s e c t i o n a n d c o n c e n t r a t e m o r e
o n d a i l y c o m p l a i n t s . S o f t w a r e m a k e s i t e a s y t o k n o w a b o u t
t h e c u s t o m e r w h e r e a s i n m a n u a l s y s t e m i t i s q u i t e d i f f i c u l t t o
k n o w a b o u t t h e c u s t o m e r w h e t h e r i t i s r e g u l a r , n e w , m e m b e r
o r n o t a m e m b e r .
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 9/80
SYSTEM
ANALYSIS
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 10/80
SYSTEM ANALYSIS
S y s te m a n a ly s i s m a y b e c o n si d e re d a s i n t er f a ce b e t we e n t h e
a c t u a l p r o b l e m a n d t h e c o m p u t e r . T h e a c t o f f i n d i n g a n s w e r s
t o q ue st io ns s uc h a s o bj ec t i ve f un ct io ns a nd p ro ce du re s
d e f i n e d t h r o u g h a p p l i c a t i o n s o f l o g i c i s c a l l e d a n a l y s i s .
S y s t e m i s a s e t o f i n t e r r e l a t ed , i n t e r a c t i ng l o g i c s t r u c t u r e d
p r o c e d u r e s a n d d e c i s i o n s r u l e s t h a t c a n c o n s i s t e n t l y f o l l o w e d
t o m e e t a n o b j e c t i v e o r a s e t o f r e s p o n d s t o t h e p r i n t a n d
p r o c e d u r e s o u t p u t s .
S Y S T E M A N A L Y S I S : -
T he i nd iv id ua l w ho p er f or ms t he s ys te m i nv es t i ga t i on a s
d i s t i n c t f r o m t h o s e i n v o l v e d i n d e t a i l e d c o m p u t e r
p r o g r a m m i n g i s c a l l e d s y s t e m a n a l y s t .
S y s te m a n a l y s t i n o r d er t o a n a l y ze a s y s te m s h o ul d f o l l o w a
m e t h o d w h i c h i t s e l f i s l o g i c a l , r e l a t i o n a l , v a l i d a n d r e l e v a n t .
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 11/80
S Y S T E M A N A L Y S I S C A N B E D I V I D E D I N T O S I X
P A R T S : -
1 . S el ec t i on an d id en t i f i ca t i on o f t he p r o j ec t \ to p i c
2 . M a k i n g a c o s t b e n e f i t a n a l y s i s a n d c o n d u c t i n g a
f e a s i b i l i t y s t u d y o f p r o j e c t .
3 . D ef in in g p re ci se ly , w ha t t he pr o j ec t i s?
4 . D e s i g n i n g a s y s t e m .
5 . I m p l e m e n t i n g t h e s y s t e m i n c l u d i n g u p d a t i n g a n d
m a i n t a i n i n g t h e s y s t e m .
6 . E va lu at io n o f e f f ic ie nc y o f s ys te m.
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 12/80
DESIGN
SYSTEM
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 13/80
SYSTEM DESIGN
F ro m t he i mm em or ia l h um an b ei ng s h av e b ee n t ry in g t o
d e v e l o p m e t h o d s t o d o t h e i r w o r k i n m o s t e f f i c i e n t w a y . I t i s
w e l l k n o wn t h a t m a n u al w o r k d o n e i s a l e n gt h y, p r o ce s s a n d
m a y h a v e n u m b e r o f e r r o r s . N e c e s s i t i e s h a v e a l w a y s l e d t o
i nv en t i on s. T o a vo id t he se d if f i cu l t ie s , a c om pu te ri ze d
a p p r o a c h t o p r o b l e m w a s t h e o n l y s o l u t i o n . I n t h i s p r o j e c t , I
h av e t r ie d m y l ev el b es t t o s pe ed u p p ro ce du re s a nd t o
m a x i m i z e e f f i c i e n c y . I h a v e d o n e m y p r o j e c t i n C b e c a u s e
t h i s s o ft w a r e p ac k ag e i s i d ea l i n c as e o f e ff ic i e nc y o f
e f f i c i e n t d a t a h a n d l i n g .
T hi s p ro je ct i s d on e i n s u ch a w a y t h at t he u se r w i th ou t
h a v i n g m u c h k n o w l e d g e a b o u t t h e c o m p u t e r o r s o f t w a r e , c a n
w o r k o n i t .
A ll t he p ro gr am s a r e l in ke d t o t he m ai n p ro gr am c al le d
M A I N . P r o g r a m M A I N d i s p l a y s a l l t h e m a j o r o p t i o n s a l l o w e d .
A c c o r d i n g t o o p t i o n n u m b e r M A I N r u n s o t h e r s u b p r o g r a m .
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 14/80
A ll t h es e s ub p r og r am s a l so d i sp l ay o t he r s ub o p ti o ns a nd
l i n k e r o t h e r s u b p r o g r a m . A f t e r e x e c u t i o n o f a p r o g r a m , t h e
p r e v i o u s p r o g r a m ( f r o m w h i c h t h e p r e s e n t p r o g r a m w a s
c a l l e d ) i s a g a i n e x e c u t e d . T h u s p r o g r a m M A I N w i l l a c t a s t h e
c o n t r o l l e r o f t h e s y s t e m .
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 16/80
/ * T he U n i te d Ba n k m ak e s c er t a i n c o mp u t er i z e d f a c i l i t i e s i n t he i r
b a n k t o
i m p l e m e n t c u s t o m e r r e c o r d s a n d t h e i r d a i l y d a i l y t r a n s a c t i o nr e c o r d s .
T h e b a n k k e e p s c e r t a i n i n f o r m a t io n a s f o l l o w :
I N I T I A L . d a t :
a c c _ n o : A c c o u n t n u m b e r
n a m e : N a m e o f t h e A c c o u n t e ea d d r e s s : A d d r e s s o f t h e a c c o u n t e e
b a l a n c e : I n i t i a l b a l a n c e o f t h e a c c o u n t
W h e n t h e a n y c u s t o m e r w i l l b e c r e a t e a n a c c o u n t , t h e b a n k w i l lk e e p t h e a b o v e f i e l d s i n t h e i r I N I T I A L . d a t f i l e a s m a s t e r
a c c o u n t h o l d e r .
B A N K I N G . d a t :a c c _ n o : A c c o u n t n u m b e r
t y p e : T r a n s a c t i o n t y p e b y C a s h / C h e q u ed d ,m m ,y y : D a te o f t r a n sa c t i o n
t r a n : T r a n s a c t i o n f o r D e p o s i t o r W i t h d r a w
i n t e r e s t : I n t e r e s t r a t ea m o u t : T r a n s a c t i o n a m o u n t
b a l a n c e : C u r r e n t b a l a n c e a f t e r t r a n s a c t i o n
W h i l e i n p u t i n g t h e d a t a r e c o r d t h e f o l l o w i n g v a l i d a t i on w i l lc h e c k :
- t h e a c c o u n t n u m b e r s w i l l g e n e r a t e a u t o m a t i c a l l y
- t h e n a m e , a d d r e s s s h o u l d n o t b l a n k - t r a n s a c t i o n d a t e w i l l b e t h e s y s t e m d a t e / c u r re n t
d a t e
- i n i t i a l d e p o s i t f o r a n y a c c o u n t n o t l e s s t h a t R s .5 0 0 / -
- D a i l y t r a n s a c t i o n w i l l b e e n t e r e d e i t h e r t h e w o r d
C a s h / C h e q u e
a n d ' D ' f o r d e p o s i t a n d ' W ' f o r w i t h d r a w
W r i t e a m e n u d r i v e n p r o g r a m f o r m a k i n g a d a i l y t r a n s a c t i o n
p r o c e s s f o r t h ed i s p l a y i n g f o l l o i n g m e n u o p t i o n s .
1 . O p e n N e w A c c o u n t2 . L i s t o f A c c o u n t s
3 . S e e I n d i v i d u a l A c c o u n t
4 . D a i l y T r a n s a c t io n
5 . M o n t h l y R e p o r t
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 17/80
6 . E d i t A c c o u n t
I n t h e e d i t a c c o u n t m e n u t h e f o l l o w i n g p r o c e s s i n g w i l l o c c u r :
1 . M o d i f y A c c o u n t2 . C l o s e A c c o u n t
0 . Q u i t
T h e f o l l o w i n g w i l l b e t h e r e p o r t f o r m a t a s
R e p o r t - 1 :A c c o u n t s L i s t i n B a n k
= = = = = = = = = = = = = = = = = = = = =
D a t e : 1 0 / 1 0 / 1 9 9 8
= = = = = = = = = = == = = = = = = = = = = == = = = = = = = = = = == = = = = = = = = = = == = = = = =
= = = = = = = = = = = = = = = = = =
A c c n o # N a m e A d d r e s s B a l a n c e
= = = = = = = = = = == = = = = = = = = = = == = = = = = = = = = = == = = = = = = = = = = == = = = = =
= = = = = = = = = = = = = = = = = =1 M r . S a n g r a m 1 2 , E - B l o c k , R o h i n i 5 6 0 0
2 M r . V i k a s 2 3 4 , V i n u s A p p t s . R o h i n i 1 2 0 0 0
- - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - -
= = = = = = = = = = == = = = = = = = = = = == = = = = = = = = = = == = = = = = = = = = = == = = = = =
= = = = = = = = = = = = = = = = = =T o t a l B a l a n c e i n B a n k i s : - - - - - -
R e p o r t - 2 :
A c c o u n t N o . 1 M r . S a n g r a m
D a t e : 1 1 / 1 0 / 1 9 9 81 2 , E - B l o c k , R o h i n i
G l o b a l R e p o r t o f A c c o u n t
= = = = = = = = = = == = = = = = = = = = = == = = = = = = = = = = == = = = = = = = = = = == = = = = =
= = = = = = = = = = = = = = = = = = =
D a t e P a r t i c u l a r D e p o s i t W i t h d r a wB a l a n c e
= = = = = = = = = = == = = = = = = = = = = == = = = = = = = = = = == = = = = = = = = = = == = = = = == = = = = = = = = = = = = = = = = = =
1 - 1 0 - 1 9 9 8 I N I T I A L 2 0 0 0 2 0 0 0
2 - 1 0 - 1 9 9 8 C A S H 3 0 0 0 5 0 0 0
8 - 1 0 - 1 9 9 8 C H E Q U E 4 0 0 0 9 0 0 0
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 18/80
9 - 1 0 - 1 9 9 8 C A S H 3 4 0 0 5 6 0 0
= = = = = = = = = = == = = = = = = = = = = == = = = = = = = = = = == = = = = = = = = = = == = = = = == = = = = = = = = = = = = = = = = = =
T o t a l - > : 9 0 0 0 3 4 0 0
5 6 0 0
R e p o r t - 3 :
A c c o u n t N o . 1 M r . S a n g r a m
D a t e : 1 1 / 1 0 / 1 9 9 8
1 2 , E - B l o c k , R o h i n i
S t a t e m e n t M o n t h : 1 0 / 0 1 / 1 9 9 9
= = = = = = = = = = == = = = = = = = = = = == = = = = = = = = = = == = = = = = = = = = = == = = = = =
= = = = = = = = = = = = = = = = = = =D a t e P a r t i c u l a r D e p o s i t W i t h d r a w
B a l a n c e
= = = = = = = = = = == = = = = = = = = = = == = = = = = = = = = = == = = = = = = = = = = == = = = = =
= = = = = = = = = = = = = = = = = = =1 - 1 0 - 1 9 9 8 I N I T I A L 2 0 0 0 2 0 0 0
2 - 1 0 - 1 9 9 8 C A S H 3 0 0 0 5 0 0 0
8 - 1 0 - 1 9 9 8 C H E Q U E 4 0 0 0 9 0 0 0
9 - 1 0 - 1 9 9 8 C A S H 3 4 0 0 5 6 0 0
= = = = = = = = = = == = = = = = = = = = = == = = = = = = = = = = == = = = = = = = = = = == = = = = =
= = = = = = = = = = = = = = = = = = =T o t a l - > : 9 0 0 0
3 4 0 0
5 6 0 0
T h i s p r o j e c t i s d e v e l o p e d u s i n g C + + c l a s s c o n c e p t s a n d h a v i n g
n u m b e r o f d i f f e r e n t
u s e r d e f i n e d f u n c t i o n ( U D F s ) a s f o l l o w s :
l i n e _ h o r ( . . . . . )
T h i s f u n c t i o n p a s s e s f o u r p a r a m e t e r s i n c l u d i n g t h r e e i n t e g e r a n d o n e
c h a r a c t e r t o
d r a w d i f f e r e n t l i n e s t o d e s i g n t h e s c r e e n b e a u t i f u l . T h e c h a r a c t e r p a r a m e t e r d r a w t h e
A S C I I c h a r a c t e r l i n e - b y - l in e o n s c r e e n . S o , f o r h o r i z o n t a l l i n e d r a w
t h i s f u n c t i o n i s u s e f u l l .
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 19/80
l i n e _ v e r ( . . . . . )
T h e D R A W _ V E R ( . . . . . ) f u n c t i o n i s h e l p f u l f o r d r a w i n g v e r t i c a l l i n e so n s c r e e n t o d e s i g n
e i t h e r m e n u o r p r o g r a m f o r m s f o r d a t a e n t r y , m o d i f y , d i s p l a y , d e l e t e
e t c . .
b o x ( . . . . . )
T h i s f u n c t i o n c r e a t e s d i f f e r e n t s i z e o f b o x e s o n t h e s c r e e n a c c o r d i n g
t o t h e r e s p e c t i v e
p a r a m e t e r s . O u t o f a l l t h e p a r a m e t e r s t h e y d r a w b o x e s t i l l t h e l i m i t
y o u w a n t .
m a i n _ m e n u ( . . . . . )
T h i s i s t h e m a i n s c r e e n i n g m e n u w h i c h w i l l d i s p l a y y o u r 6 d i f f e r e n t p r o m p t s a n d h a v i n g d i f f e r e n t a c t i v i t i e s .
E a c h p r o m p t i s c o n n e c t e d w i t h d i f f e r e n t f u n c t i o n s t o p e r f o r m t h er e s p e c t i v e p u r p o s e s . O u t o f a l l t h e o p t i o n s
t h e l a s t o n e p r o d u c e s a n o t h e r s u b - m e n u f o r m o d i f y i n g a n d d e l e t i n g
e x i s t i n g a c c o u n t i n f o r m a t io n s .
W h i l e h a n d l i n g t h e m a i n m e n u y o u c a n p r e s s a n y s e l e c t i v e n u m b e r t o
p e r f o r m t h e o p e r a t i o n o r p r e s s 0 ( Z e r o ) t o e x i t f r o m
t h e m a i n m e n u . B u t i t i s a l s o h e l p f u l i n a l m o s t a l l m e n u s t h a t , y o uc a n p r e s s 0 ( z e r o ) t o e x i t f r o m t h e r e s p e c t i v e m e n u .
e d i t _ m e n u ( . . . . . )
T h i s i s o n e o f t h e s u b f u n c t i o n w h i c h i s c o n n e c t e d f r o m t h e
m a i n _ m e n u ( ) f u n c t i o n t o p e r f o r m t h e m o d i f i c a t io n a n d d e l e t i o no p e r a t i o n
o n b a n k i n g a c c o u n t d a t a f r o m I N I T I A L . d a t a n d B A N K I N G . d a t d a t a
f i l e .
A l l t h e t h e w a y s t h e m e n u s a r e p e r f o r m t h e o p e r a t i o n a c c o r d i n g t o
t h e a c c o u n t n u m b e r ( a c c n o ) e x c e p t
t h e " O p e n N e w A c c o u n t " o f m a i n _ m e n u ( ) f u n c t i o n b e c a u s e , t h e" O p e n N e w A c c o u n t " f o r m a u t o m a t i c a l l y c r e a t e s
t h e a c c o u n t n u m b e r a f t e r a b r i e f s e a r c h t o t h e e x i s t i n g a c c o u n t
n u m b e r s .B a s i c a l l y , t h e n u m b e r s a r e g e n e r a t i n g a u t o m a t i c a l l y , l i k e y o u r 1 , 2 ,
3 . . . r e s p e c t i v e ly .
a d d _ t o _ f i l e ( . . . )
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 20/80
T h e f u n c t i o n a d d _ t o _ f i l e i s u s e d t o a p p e n d n e w a c c o u n t d e t a i l s i n t o
t h e I N I T I A L . d a t f i l e . T h i s f u n c t i o n r e c e i v e s a l l t h e f i e l d s a s p a r a m e n t e r w a y
f r o m t h e n e w _ a c c o u n t ( ) f u n c t i o n a n d a d d s i n t h e d a t a f i l e .
d i s p l a y _ l i s t ( )
T h i s f u n c t i o n i s u s e d t o d i s p l a y a l l t h e a c c o u n t d a t a i n t h e s c r e e n .W h i c h d i s p l a y s t h e a c c o u n t n o # , n a m e , a d d r e s s a n d
t h e i r r e s p e c t i v e b a l a n c e a m o u n t i n b a n k . A l s o s h o w t h e t o t a l b a n k
b a l a n c e i n t h e s c r e e n . A l l t h e r e c o r d s a r e e x t r a c t e d f r o m
I N I T I A L . d a t d a t a f i l e .
d e l e t e _ a c c o u n t ( )
T h i s f u n c t i o n i s u s e d t o d e l e t e t h e a c c o u n t d e t a i l s f r o m I N I T I A L . d a td a t a f i l e . T h i s i s a c o p y m e t h o d w h i c h
t r a n s f e r s a l l t h e r e c o r d s e x c e p t d e l e t e d a c c n o # . A n d o n t h e s a m e w a yt h e r e c o r d s a r e r e v e r s e d f r o m t h e T E M P . d a t f i l e
t o t h e o r i g i n a l d a t a f i l e I N I T I A L . d a t .
u p d a t e _ b a l a n c e ( )
W h e n t h e r e i s a f r e s h t r a n s a c t io n h a p p e n s o n a n e x i s t i n g a c c o u n t
e i t h e r d e p o s i t ( D ) o r w i t h d r a w ( W ) , t h e n t h e r e s p e c t i v e b a l a n c e h a st o u p d a t e d
i n t h e I N I T I A L . d a t d a t a f i l e . W h i l e t h e t r a n s a c t i o n s c o m p l e t e , t h e
b a l a n c e a m o u n t i s o v e r w r i t t e n i n t h ed a t a f i l e . T h i s t e c h n i q u e o c c u r s b y l o c a t i n g t h e p o s i t i o n i n t h e d a t a
f i l e o n l y .
m o d i f y ( )
W h e n t h e r e i s a n y m o d i f i c a t i o n o c c u r s t o t h e a c c o u n t s n a m e a n d
a d d r e s s o r t o t h e b a l a n c e a m o u n t , t h e s i m u l t a n e o u s l y i t b e c o m e sm o d i f i e d i n t h e
I N I T I A L . d a t d a t a f i l e t h r o u g h t h e m o d i f y _ a c c o u n t ( ) f u n c t i o n . T h i s
p r o c e s s h i g h l y d e p e n d s o n t h e k e y f i e l d a c c o u n t n u m b e r .
l a s t _ a c c n o ( )
W h e n a n e w r e c o r d h a s t o a p p e n d i n t o t h e d a t a f i l e , i t h a s t o c r e a t e
a n a u t o m a t i c a c c n o # . T h i s p r o c e s s h a p p e n s w h e n w e k n o w t h e l a s t
a c c o u n t n u m b e r . T o
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 21/80
k n o w t h e l a s t a c c o u n t n u m b e r b y u s i n g t h e l a s t _ a c c n o ( ) f u n c t i o n .
A f t e r f i n d i n g t h e l a s t a c c o u n t n o . i t r e t u r n s t h e l a s t a c c o u n t v a l u e
i n t o t h e n e w _ a c c o u n t ( ) f u n c t i o nf o r g e n e r a t i n g n e x t a c c o u n t n u m b e r .
f o u n d _ a c c o u n t ( )
T o d o a n y o p e r a t i o n : e i t h e r f o r m o d i f i c a t io n , d e l e t i o n , r e p o r t ( s ) o r
u p d a t i o n , e v e r y t i m e t h e f o u n d _ a c c o u n t ( ) f u n c t i o n f i r s t c h e c k s t h ea c c o u n t w h i c h i s e n t e r e d b y t h e
u s e r i s t h e i r i n t h e I N I T I A L . d a t d a t a f i l e o r n o t . I f i t i s t h e i r t h e n a
t r u e v a l u e i s r e t u r n e d e l s e a f a l s e v a l u e i s r e t u r n e d . W h i l e d e p e n d i n g
t h e v a l u e f u r t h e r p r o c e s s c a no c c u r s .
* r e t u r n _ n a m e ( )
W h e n a n y r e p o r t s a r e o c c u r , o n t o p o f t h e r e p o r t t h e a c c o u n t n a m e i s
d i s p l a y e d . T h i s f u n c t i o n r e t u r n s t h e n a m e o f t h e a c c o u n t h o l d e r a n dd i s p l a y s i n a p p r o p r i a t e r e p o r t .
* r e t u r n _ a d d r e s s ( )
W h e n a n y r e p o r t s a r e o c c u r , o n t o p o f t h e r e p o r t t h e a c c o u n t a d d r e s s
i s d i s p l a y e d . T h i s f u n c t i o n r e t u r n s t h e a d d r e s s o f t h e a c c o u n t h o l d e r
a n d d i s p l a y s i n a p p r o p r i a t e r e p o r t .
g i v e _ b a l a n c e ( )
W h i l e d a i l y t r a n s a c t i o n i s o c c u r s , t h e l a s t b a l a n c e i s a l w a y s r e q u i r e d
t o u p d a t e t h e I N I T I A L . d a t d a t a f i l e . S o , t o k n o w t h e l a s t b a l a n c e a t
t h e t i m e o f d a i l y t r a n s a c t i o n t h e g i v e _ b a l a n c e f u n c t i o n r e t u r n s t h e v a l u e t o t h e
t r a n s a c t io n ( ) f u n c t i o n .
r e c o r d n o ( )
E i t h e r f o r n e w _ a c c o u n t , u p d a t e a c c o u n t , o r m o d i f y a c c o u n t , o r
m o d i f y b a l a n c e t h e r e c o r d n o ( ) f u n c t i o n f i n d s t h er e c o r d p o s i t i o n o f e x i s t i n g a c c o u n t n o . i n t h e d a t a f i l e s , w h e r e t h e
t r a n s a c t e d r e c o r d c a n o v e r w r i t t e n .
d i s p l a y ( )
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 22/80
T h e f u n c t i o n i s u s e d t o d i s p l a y t h e a c c o u n t d e t a i l s f r o m e i t h e r
I N I T I A L . d a t o r B A N K I N G . d a t d a t a f i l e . W h i l e t h e m o d i f y ( ) f u n c t i o n
a c t i v e s , t h e a c c n o p a r a m e t e r s e a r c h e s t h i sa c c o u n t d e t a i l s f r o m t h e r e s p e c t i v e f i l e t o d i s p l a y o n t h e s c r e e n
b e f o r e m o d i f y .
m o d i f y _ a c c o u n t ( )
T h i s f u n c t i o n i s u s e d t o m o d i f y t h e e x i s t i n g a c c o u n t s n a m e a n da d d r e s s a t t h e e x i s t i n g l o c a t i o n . T o m o d i f y t h e a c c o u n t i t f i r s t
s e a r c h e s t h e a c c o u n t s l o c a t i o n a n d o v e r w r i t t e n a t t h e s a m e l o c a t i o n
u s i n g s e e k g ( ) f u n c t i o n .
n e w _ a c c o u n t ( )
T h i s f u n c t i o n i s u s e d t o c r e a t e a n e w a c c o u n t o f a c u s t o m e r a f t e r
e n t e r i n g a l l t h e d e t a i l s o f t h e s a m e . I n t h i s s c r e e n t h e a u t o m a t i ca c c o u n t n u m b e r i s c r e a t e d a n d a p r o p r v a l i d a t i o n s a r e t h e i r i n t o
n a m e , a d d r e s s , a n d i n i t i a l d e p o s i t .A f t e r e n t e r i n g a l l t h e i n f o r m a t i o n s r e l a t e d t o t h e c u s t o m e r , t h e
r e c o r d s a r e a p p e n d e d i n t h e I N I T I A L . d a t a n d B A N K I N G . d a t d a t a f i l e
b y u s e i n g a f u n c t i o n a d d _ t o _ f i l e o f b o t h c l a s s i n i t i a l a n d a c c o u n t .
c l o s e _ a c c o u n t ( )
O n t h e s a m e w a y l i k e d e l e t e _ a c c o u n t ( ) f u n c t i o n , t h e c l o s e _ a c c o u n t ( )f u n c t i o n a l s o c l o s e s a l l t h e t r a n s a c t i o n r e c o r d i n B A N K I N G . d a t d a t a
f i l e .
A f t e r c l o s i n g t h e a c c o u n t t h e r e i s n o t r a n s a c t i o n r e c o r d s a r e i n t h ed a t a f i l e s .
d i s p l a y _ a c c o u n t ( )
T h i s f u n c t i o n i s u s e d t o d i s p l a y a l l t h e t r a n s a c t i o n i n c l u d e i n g t h e
i n i t i a l d e p o s i t i n t h e s c r e e n . T h i s i s a g l o b a l r e p o r t t o d i s p l a y
a l l t h e t r a n s a c t i o n r e c o r d s i n t h e s c r e e n . I t s h o w s a l l t h e d e p o s i t sa n d w i t h d r a w c o l u m n a n d d a t e w i s e b a l a n c e a l s o .
t r a n s a c t i o n ( )
T h e t r a n s a c t i o n ( ) f u n c t i o n p r o v i d e s a s c r e e n f o r m a k i n g d a i l y
t r a n s a c t io n . W h i l e t r a n s a c t i o n i t s h o w t h e b a l a n c e a m o u n t , a n d t h e ne i t e r a t r a n s a c t i o n f o r d e p o s i t ( D ) o r w i t h d r a w ( W ) o n e i t h e r C A S H o r
C H E Q U E .
T h e n t h e t r a n s a c t e d r e c o r d i s u p d a t e d i n t h e I N I T I A L . d a t a n d
B A N K I N G . d a t d a t a f i l e . A l s o t h e s a m e f u n c i t o n s u s e d t w o i m p o r t a n t
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 23/80
f u n c t i o n u p d a t e _ b a l a n c e ( ) a n d a d d _ t o _ f i l e t o u p d a t e b a l a n c e i n
I N I T I A L . d a t d a t a f i l e a n d
t h e t r a n s a c t e d r e c o r d i n B A N K I N G . d a t d a t a f i l e .
c l e a r ( )
T h e f u n c t i o n i s u s e d t o c l e a r t h e s c r e e n f r o m a s p e c i f i e d r o w a n d
c o l u m n p o s i t i o n .
m o n t h _ r e p o r t ( )
L i k e a n y o t h e r b a n k i n g t r a n s a c t i o n , w h e n a c u s t o m e r w a n t h i s
m o n t h l y r e p o r t t h i s f u n c t i o n h e l p s t o g e n e r a t e t h e r e p o r t o n t h es c r e e n .
W h e n y o u e n t e r a d a t e a n a c c o u n t n u m b e r , i t s e a r c h e s a l l t h e
t r a n s a c t io n o f t h e p r e v i o u s m o n t h o f t h e e n t e r d a t e a n d e x t r a c t s a
p r e v i o u s b a l a n c e ( B / F . . . ) a m o u n tf i r s t o n t h e s c r e e n a n d t h e n t h e e n t e r e d m o n t h s a l l t h e t r a n s a c t io n o n
t h e s c r e e n . F i n a l l y s h o w s t h e c u r r e n t b a l a n c e a m o u n t a l s o .
a d d _ t o _ f i l e ( )
T h i s f u n c t i o n i s u s e d t o a p p e n d n e w r e c o r d i n t o t h e B A N K I N G . d a t
d a t a f i l e . W h i l e t h e f u n c t i o n a c t i v e s , i t p a s s e d a l l t h e f i e l d s a s
p a r a m e t e r i n t o t h e f u n c t i o n a n d
a p p e n d s a s a f r e s h r e c o r d i n t o t h e f i l e .
d e l e t e _ a c c o u n t ( )
T h i s f u n c t i o n i s u s e d t o d e l e t e t h e a c c o u n t f r o m t h e B A N K I N G . d a t
d a t a f i l e . T h i s i s a c o p y m e t h o d t o d e l e t e t h e a c c o u n t f r o m f i l e .
n o _ o f _ d a y s ( )
T h i s f u n c t i o n i s u s e d t o f i n d t o t a l n u m b e r o f y e a r s , m o n t h s a n d d a y s
b e t w e e n t w o d a y s .
b o x _ f o r _ d i s p l a y ( )
T h i s f u n c t i o n i s u s e d t o d i s p l a y t h e h e a d i n g o f t h e r e p o r t a s :
D a t e P a r t i c u l a r D e p o s i t W i t h d r a wB a l a n c e
* /
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 24/80
/ / D e c l a r a t i o n o f h e a d e r f i l e s
# i n c l u d e < i o s t r e a m . h ># i n c l u d e < f s t r e a m . h >
# i n c l u d e < p r o c e s s . h >
# i n c l u d e < s t r i n g . h ># i n c l u d e < s t d i o . h >
# i n c l u d e < c t y p e . h >
# i n c l u d e < c o n i o . h ># i n c l u d e < d o s . h >
# i n c l u d e < s t d l i b . h >
# i n c l u d e < i o m a n i p . h >
# i n c l u d e < g r a p h i c s . h >
t y p e d e f c h a r o p t i o n [ 1 5 ] ;
c o n s t i n t R O W = 1 0 , C O L = 1 0 ;
i n t s c a n ; / / To h o ld t h e s p e ci a l c h a r ac t e r s f o r m o v in g t he p r om p t i nm e n u
i n t a s c i i ;
/ / T o d i s p l a y t h e m a i n m e n u o p t i o n s
o p t i o n a [ ] = {
" N e w A c c o u n t " ,
" L i s t o f A c c o u n t s " ," I n d A c c o u n t " ,
" D a i l y T r a n s " ,
" M o n t h l y R e p o r t " ," E d i t A c c o u n t " ,
" E x i t " } ;
/ / D i s p l a y s t h e m o d i f y m e n u o p t i o n s
o p t i o n b [ ] = {
" M o d i f y A c c o u n t " ,
" C l o s e a c c o u n t " ," Q u i t "
} ;
/ / F u n c t i o n u s e d t o d o s c r e e n i n g
c l a s s m a i n _ m e n u
{i n t i , d o n e ;
p u b l i c :
v o i d n o r m a l v i d e o ( i n t x , i n t y , c h a r * s t r ) ;
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 25/80
v o i d r e v e r s e v i d e o ( i n t x , i n t y , c h a r * s t r ) ;
v o i d b o x ( i n t x 1 , i n t y 1 , i n t x 2 , i n t y 2 ) ;
c h a r m e n u ( ) ;v o i d c o n t r o l _ m e n u () ;
c h a r e _ m e n u ( ) ;
v o i d e d i t _ m e n u ( ) ;v o i d h e l p ( v o i d ) ;
} ;
/ * C l a s s m e m b e r f u n c t i o n s f o r d r a w i n g b o x e s * /
c l a s s s h a p e
{
p u b l i c :v o i d l i n e _ h o r ( i n t , i n t , i n t , c h a r ) ;
v o i d l i n e _ v e r ( i n t , i n t , i n t , c h a r ) ;
v o i d b o x ( i n t , i n t , i n t , i n t , c h a r ) ;
} ;
/ / C l a s s c o n t a i n s t h e i n i t i a l d e p o s i t o f c u s t o m e r s
c l a s s i n i t i a l
{ p u b l i c :
v o i d a d d _ t o _ f i l e ( i n t , c h a r t _ n a m e [ 3 0 ] , c h a r t _ a d d r e s s [ 3 0 ] ,
f lo a t ) ; / / F o r i n i t i al de po s i ts i n c us to me rs a cc ou n t
v o i d d i s p l a y _ l i s t ( v o i d ) ; / / D i s p l a y i n g c u s t o m e r s a c c o u n tl i s t
v o i d d e l e t e _ a c c o u n t ( i n t ) ; / / D e l e t i n g c u s t o m e r s a c c o u n t
v o i d u p d a t e _ b a l a n c e ( i n t , c h a r t _ n a m e [ 3 0 ] , c h a r t _ a d d r e s s [ 3 0] , f l o a t ) ; / / F o r u p d a t i n g t h e c u s t o m e r a c c o u n t
v o i d m o d i f y ( v o i d) ; / / T o m o d i f y t h e c u s t o m e r a c c o u n t
i n f o r m a t i o ni n t l a s t _ a c c n o ( v o i d ) ; / / T o k n o w t h e l a s t a c c o u n t n u m b e r
i n t f o u n d _ a c c o u n t ( i n t ) ; / / T o f o u n d t h e a c c o u n t i s i n
" I N I T I A L . d a t" o r n o t
c h a r * r e t u r n _ n a m e ( i n t ) ; / / F u n c t i o n f o r v a l i d a t i o n e n t r y o f
c u s t o m e r n a m e
c h a r * r e t u r n _ a d d r e s s ( i n t ) ; / / F u n c t i o n f o r v a l i d a t i o n e n t r yo f c u s t o m e r a d d r e s s
f l o a t g i v e _ b a l a n c e ( i n t ) ; / / T o p r i n t t h e b a l a n c e a m o u n t o f
a p a r t i c u l a r c u s t o m e r i n t r e c o r d n o ( i n t ) ;
v o i d d i s p l a y ( i n t ) ; / / T o d i s p l a y t h e c u s t o m e r a c c o u n t
p r i v a t e :
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 26/80
v o i d m o d i f y _ a c c o u n t ( i n t , c h a r t _ n a m e [ 3 0 ] , c h a r
t _ a d d r e s s [ 3 0] ) ; / / F u n c t i o n t o m o d i f y t h e c u s t o m e r ac c o u n t
i n t a c c n o ;c h a r n a m e [ 3 0 ] , a d d r e s s [ 3 0 ] ;
f l o a t b a l a n c e ;
} ;
/ / C l a s s c o n t a i n s t h e c u s t o m e r s d a i l y t r a n s a c t i o n e n t r y
c l a s s a c c o u n t
{
p u b l i c :
v o i d n e w _ a c c o u n t( v o i d ) ; / / F u n c t i o n t o c r e a t e a n e wa c c o u n t
v o i d c l o se _ a c c o u n t ( v o i d ) ; / / F u n c t i o n t o c l o s e a n a c c o u n t
v o i d d i s p l a y _ a c c o u n t ( v o i d ) ; / / F u n c t i o n t o d i s p l a y t h e
a c c o u n t s v o i d t r a n s a c t i o n ( v o i d ) ; / / T o d i s p l a y t h e t r a n s a c t io n
p r o c e s sv o i d c l e a r ( i n t , i n t ) ; / / F u n c t i o n t o p e r f o r m a c l e a r s c r e e n
f u n c t i o n
v o i d m o n t h _ r e p o r t ( v o i d ) ; / / F u n c t i o n t o l i s t m o n t h W i s et r a n s a c t io n r e p o r t
p r i v a t e :
v o i d a d d _ t o _ f i l e ( i n t , i n t , i n t , i n t , c h a r , c h a r t _ t y p e [ 1 0 ] ,f l o a t , f l o a t , f l o a t ) ; / / F u n c t i o n t o a d d t r a n s a c t i o n r e c o r d s
v o i d d e l e t e _ a c c o u n t ( i n t ) ; / / F u n c t i o n t o d e l e t e a
t r a n s a c t io n r e c o r di n t n o _ o f _ d a y s ( i n t , i n t , i n t , i n t , i n t , i n t ) ; / / F u n c t i o n t o
f i n d t h e t o t a l d a y s
f l o a t c a l c u l a t e _ i n t e r e s t ( i n t , f l o a t ) ; / / F u n c t i o n f o r c a l c u l a t i n g i n t e r e s t o f a n a c c o u n t
v o i d d i s p l a y ( i n t ) ; / / F u n c t i o n t o d i s p l a y a t r a n s a c t i o n
a c c o u n t
v o i d b o x _ f o r _ d i s p l a y ( i n t ) ; / / F u n c t i o n f o r d i s p l a y i n g b o xi n t a c c n o ;
c h a r t yp e [1 0 ] ; / / Ac c ou n t t y pe a s Ch e qu e o r C as h
i n t d d , m m , y y ; / / T o s t o r e t h e s y s t e m d a t e / E n t e r d a t ec h a r t r a n ; / / A s t h e a c c o u n t t y p e i s D e p o s i t o r
W i t h d r a w
f l o a t i n t e r e s t , a m o u n t , b a l a n c e ;} ;
/ / F u n c t i o n t o d i s p l a y s a l l t h e m e n u p r o m p t m e s s a g e s f r o m t h e
p o i n t e r a r r a y o f o p t i o n a [ ]
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 27/80
v o i d m a i n _ m e n u : : n o r m a l v i d e o ( i n t x , i n t y , c h a r * s t r )
{
g o t o x y ( x , y ) ;c p r i n t f ( " % s " , s t r ) ;
}
/ / F u n c t i o n t o m o v e t h e c u r s o r o n t h e m e n u p r o m p t w i t h a r e v e r s e
v i d e o c o l o r
v o i d m a i n _ m e n u : : r e v e r s e v id e o ( i n t x , i n t y , c h a r * s t r ){
t e x t c o l o r ( 5 + 1 4 3 ) ;
t e x t b a c k g r o u n d ( W H I T E ) ;
g o t o x y ( x , y ) ;c p r i n t f ( " % s " , s t r ) ;
t e x t c o l o r ( G R E E N ) ;
t e x t b a c k g r o u n d ( B L A C K ) ;
}
v o i d m a i n _ m e n u : : b o x ( i n t x 1 , i n t y 1 , i n t x 2 , i n t y 2 ){
f o r ( i n t c o l = x 1 ; c o l < x 2 ;c o l + + )
{g o t o x y ( c o l , y 1 ) ;
c p r i n t f ( " % c " , 1 9 6 ) ;
g o t o x y ( c o l , y 2 ) ;
c p r i n t f ( " % c " , 1 9 6 ) ;}
f o r ( i n t r o w = y 1 ; r o w < y 2; r o w + + ){
g o t o x y ( x 1 , r o w ) ;
c p r i n t f ( " % c " , 1 7 9 ) ;g o t o x y ( x 2 , r o w ) ;
c p r i n t f ( " % c " , 1 7 9 ) ;
}
g o t o x y ( x 1 , y 1 ) ;c p r i n t f ( " % c " , 2 1 8 ) ;
g o t o x y ( x 1 , y 2 ) ;
c p r i n t f ( " % c " , 1 9 2 ) ;g o t o x y ( x 2 , y 1 ) ;
c p r i n t f ( " % c " , 1 9 1 ) ;
g o t o x y ( x 2 , y 2 ) ;c p r i n t f ( " % c " , 2 1 7 ) ;
}
c h a r m a i n _ m e n u : : me n u ( )
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 28/80
{
c l r s c r ( ) ;
t e x t c o l o r ( 2 2 ) ;
b o x ( 2 0 , 6 , 6 5 , 2 0 ) ;
b o x ( 1 8 , 4 , 6 7 , 2 2 ) ;t e x t c o l o r ( 5 + 1 4 3 ) ;
g o t o x y ( 3 6 , 5 ) ;
t e x t b a c k g r o u n d ( B L U E ) ;c p r i n t f ( " B A N K I N G " ) ;
t e x t b a c k g r o u n d ( B L A C K ) ;
t e x t c o l o r ( 2 2 ) ;
f o r ( i = 1 ; i < 7 ; i + + )n o r m a l v i d e o (3 2 , i + 1 0 , a [ i ] ) ;
r e v e r s e v i d e o (3 2 , 1 0 , a [ 0 ] ) ;
i = d o n e = 0 ;
_ s e t c u r s o r t y p e ( _ N O C U R S O R ) ;d o
{i n t k e y = g e t c h ( ) ;
s w i t c h ( k e y )
{c a s e 0 0 :
k e y = g e t c h ( ) ;
s w i t c h ( k e y )
{c a s e 7 2 :
n o r m a l v i d e o (3 2 , i + 1 0 , a [ i ] ) ;
i - - ;i f ( i = = - 1 )
i = 6 ;
r e v e r s e v i d e o ( 3 2 , i + 1 0 , a [ i ] ) ; b r e a k ;
c a s e 8 0 :
n o r m a l v i d e o (3 2 , i + 1 0 , a [ i ] ) ;
i + + ;i f ( i = = 7 )
i = 0 ;
r e v e r s e v i d eo ( 3 2 , i + 1 0 , a [ i ] ) ; b r e a k ;
}
b r e a k ;c a s e 1 3 :
d o n e = 1 ;
}
}
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 29/80
w h i l e ( ! d o n e ) ;
_ s e t c u r s o r t y p e ( _ N O C U R S O R ) ;
r e t u r n ( i + 4 9 ) ;}
/ * T h e f u n c t i o n m a i n _ m e n u ( ) i s u s e d t o d i s p l a y t h e m a i n m e n u o f b a n k i n g s y s t e m /
T h e f u n c t i o n u s e s 6 m a i n o p t i o n s a n d e a c h h a s i t s s p e c i f i c p u r p o s e s
f o r m a i n t a i n i n g t h e a c c o u n t . I n t h i s m e m ui f t h e u s e r w i l l p r e s s w i t h i n 1 t o 6 t h e n t h e s u b s e q u e n t f a c i l i t y w i l l
a v a i l , o t h e r w i s e , i f w i l l p r e s s a n y o t h e r k e y
t h e n t h e p r o m p t w i l l c o m e b a c k f r o m t h e m e n u t o y o u r s o u r c e
p r o g r a m . O r i t i s b e t t e r t o p r e s s ' 0 ' f o r e x i s t i n g f r o m t h e m e n u .O t h e r t h a n 0 a n d 1 . . 6 i f y o u r p r e s s
a n y o t h e r k e y t h e b a n k i n g s y s t e m d o e s n o t r e s p o n s e y o u b u t s t i l l i n
s a m e s c r e e n t i l l a v a l i d n u m b e r . * /
v o i d m a i n _ m e n u : : c o n tr o l _ m e n u ( ){
c h a r c h o i c e ;
a c c o u n t a ;
d o
{
c h o i c e = m e n u ( ) ;
c l r s c r ( ) ;s w i t c h ( c h o i c e )
{
c a s e ' 1 ' : _ s e t c u r s o r t y p e ( _ N O R M A L C U R S O R ) ;
b o x ( 3 , 1 , 7 5 , 2 4 ) ;
b o x ( 5 , 2 , 7 3 , 2 3 ) ;
a . n e w _ a c c o u n t ( ) ; / / N e w a c c o u n t m e m b e r
f u n c t i o n
b r e a k ;c a s e ' 2 ' :
b o x ( 3 , 1 , 7 5 , 2 4 ) ;
b o x ( 5 , 2 , 7 3 , 2 3 ) ;i n i t i a l i n i ;
i n i . d i s p l a y _ l i s t ( ) ; / / G l o g a l l i s t o f a c c o u n t
f u n c t i o n b r e a k ;
c a s e ' 3 ' :
b o x ( 3 , 1 , 7 5 , 2 4 ) ;
b o x ( 5 , 2 , 7 3 , 2 3 ) ;
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 30/80
_ s e t c u r s o r t y p e ( _ N O R M A L C U R S O R ) ;
a . d i s p l a y _ a c c o u n t( ) ; / / D i s p l a y i n g i n d i v i d u a la c c o u n t s a l l t r a n s a c t io n s
b r e a k ;
c a s e ' 4 ' : b o x ( 3 , 1 , 7 5 , 2 4 ) ;
b o x ( 5 , 2 , 7 3 , 2 3 ) ;
a c c o u n t a ;
_ s e t c u r s o r t y p e ( _ N O R M A L C U R S O R ) ;
a . t r a n s a c t io n ( ) ; / / D a i l y t r a n s a c t i o n f o r
i n d i v i d u a l a c c o u n tb r e a k ;
c a s e ' 5 ' :
b o x ( 3 , 1 , 7 5 , 2 4 ) ;
b o x ( 5 , 2 , 7 3 , 2 3 ) ;
_ s e t c u r s o r t y p e ( _ N O R M A L C U R S O R ) ;a . m o n t h _ r e p o r t ( ) ; / / M o n t h l y r e p o r t f o r a n y
a c c o u n t
b r e a k ;c a s e ' 6 ' :
b o x ( 3 , 1 , 7 5 , 2 4 ) ;
b o x ( 5 , 2 , 7 3 , 2 3 ) ;
g o t o x y ( 1 0 , 1 0 ) ;e d i t _ m e n u ( ) ; / / S u b m e n u f o r m o d i f y i n g o r
d e l e t i n g a n y a c c o u n t
b r e a k ;c a s e ' 7 ' : e x i t ( 0 ) ;
}
} w h i l e ( c h o i c e ! = 6 ) ;}
/ * T h i s f u n c t i o n i s u s e d t o r e t u r n t h e c u r s o r p o s i t i o n t o t h e e d i t
m e n u f u n c t i o n w h e r e t h em e n u p r o m p t w i l l v a l i d * /
c h a r m a i n _ m e n u : : e_ m e n u ( ){
c l r s c r ( ) ;
t e x t c o l o r ( 2 2 ) ;
b o x ( 2 5 , 6 , 6 0 , 1 5 ) ;
b o x ( 2 3 , 4 , 6 2 , 1 7 ) ;
t e x t c o l o r ( 5 + 1 4 3 ) ;
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 31/80
g o t o x y ( 3 4 , 5 ) ;
t e x t b a c k g r o u n d ( G R E E N ) ;c p r i n t f ( " E D I T - M E N U " ) ;
t e x t c o l o r ( 2 2 ) ;
t e x t b a c k g r o u n d ( B L A C K ) ;f o r ( i = 1 ; i < 3 ; i + + )
n o r m a l v i d e o ( 3 2 , i + 1 0 , b [ i ] ) ;
r e v e r s e v i d e o (3 2 , 1 0 , b [ 0 ] ) ;
i = d o n e = 0 ;
_ s e t c u r s o r t y p e ( _ N O C U R S O R ) ;d o
{
i n t k e y = g e t c h ( ) ;
s w i t c h ( k e y ){
c a s e 0 0 :k e y = g e t c h ( ) ;
s w i t c h ( k e y )
{c a s e 7 2 :
n o r m a l v i d e o (3 2 , i + 1 0 , b [ i ] ) ;
i - - ;
i f ( i = = - 1 )i = 2 ;
r e v e r s e v i d eo ( 3 2 , i + 1 0 , b [ i ] ) ;
b r e a k ;c a s e 8 0 :
n o r m a l v i d e o (3 2 , i + 1 0 , b [ i ] ) ;
i + + ;i f ( i = = 3 )
i = 0 ;
r e v e r s e v i d eo ( 3 2 , i + 1 0 , b [ i ] ) ;
b r e a k ;}
b r e a k ;
c a s e 1 3 :d o n e = 1 ;
}
}w h i l e ( ! d o n e ) ;
_ s e t c u r s o r t y p e ( _ N O C U R S O R ) ;
r e t u r n ( i + 4 9 ) ;
}
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 32/80
/ * F u n c t i o n f o r e d i t m e n u w i t h a c c o u n t m o d i f i c a t i o n a n d c l o s e
T h i s i s t h e o n e o f t h e s u b m e n u w h i c h m a n a g e s t w o b a s i c o p e r a t i o n sa s :
- E d i t i n g a n y a c c o u n t
- D e l e t i n g a n y a c c o u n tW h i l e e d i t i n g a n y a c c o u n t , y o u h a v e t o e n t e r t h e a c c o u n t n o , a n d
w i l l d i s p l a y t h e n a m e a n d a d d r e s s o f t h a t
p a r t i c u l a r a c c o u n t e e a n d w i l l d i s p l a y a p r o m p t a s " M o d i f y t h i sa c c o u n t < y / n > : " . I f y o u w i l l p r e s s ' y ' t h e n
t h e r e s p e c t i v e i n f o r m a t io n w i l l b e m o d i f i e d o t h e r w i s e w i l l r e t u r n t o
m a i n m e n u .
W h i l e d e l e t i n g a n y a c c o u n t , y o u h a v e t o e n t e r t h e a c c o u n t n o . a n dw i l l d i s p l a y t h e n a m e a n d a d d r e s s o f t h a t
p a r t i c u l a r a c c o u n t e e a n d w i l l d i s p l a y a p r o m p t a s " C l o s e t h i s
a c c o u n t ? ? " . I f y o u w i l l p r e s s ' y ' t h e n a l l t h e t r a n s a c t io n s f r o m
" B A N K I N G . d a t " f i l ea n d i n i t i a l d e p o s i t f r o m " I N I T I A L . d a t " f i l e w i l l b e d e l e t e t h e
i n f o r m a t io n o f t h e e n t e r e d a c c o u n t n u m b e r . * /
v o i d m a i n _ m e n u : : e d i t _ m e n u ( )
{
c h a r c h o i c e ;
a c c o u n t a ;
d o
{
c h o i c e = e _ m e n u ( ) ;c l r s c r ( ) ;
s w i t c h ( c h o i c e )
{c a s e ' 1 ' :
b o x ( 3 , 1 , 7 5 , 2 4 ) ;
b o x ( 5 , 2 , 7 3 , 2 3 ) ;
i n i t i a l i n i ; _ s e t c u r s o r t y p e ( _ N O R M A L C U R S O R ) ;
i n i . m o d i f y ( ) ;
b r e a k ;
c a s e ' 2 ' :
b o x ( 3 , 1 , 7 5 , 2 4 ) ; b o x ( 5 , 2 , 7 3 , 2 3 ) ;
a c c o u n t a ;
_ s e t c u r s o r t y p e ( _ N O R M A L C U R S O R ) ;
a . c l o s e _ a c c o u n t ( ) ;
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 33/80
b r e a k ;
c a s e ' 3 ' :
r e t u r n ;}
} w h i l e ( c h o i c e ! = 6 ) ;
}
/ * F u n c t i o n t o d r a w h o r i z o n t a l l i n e
T h i s p u b l i c f u n c t i o n d r a w s o n e h o r i z o n t a l l i n e a t a t i m e * /v o i d s h a p e : : l i n e _ h o r ( i n t c o l u m n 1 , i n t c o l u m n 2 , i n t r o w , c h a r c )
{
f o r ( c o l u m n 1 ; c o l u m n 1 < = c o l u m n 2 ; c o l u m n 1 + + )
{g o t o x y ( c o l u m n 1 , r o w ) ;
c o u t < < c ;
}
}
/ * F u n c t i o n t o d r a w v e r t i c a l l i n eT h i s p u b l i c f u n c t i o n d r a w s o n e v e r t i c a l l i n e a t a t i m e * /
v o i d s h a p e : : l i n e _ v e r ( i n t r o w 1 , i n t r o w 2 , i n t c o l u m n , c h a r c )
{f o r ( r o w 1 ; r o w 1 < = r o w 2 ; r o w 1 + + )
{
g o t o x y ( c o l u m n , r o w 1 ) ;
c o u t < < c ;}
}
/ * F u n c t i o n f o r d r a w i n g b o x
T h i s f u n c t i o n d r a w s a b o x f o r m e n u s * /
v o i d s h a p e : : b o x ( i n t c o l u m n 1 , i n t r o w 1 , i n t c o l u m n 2 , i n t r o w 2 , c h a r c )
{
c h a r c h = 2 1 8 ;
c h a r c 1 , c 2 , c 3 , c 4 ;c h a r l 1 = 1 9 6 , l 2 = 1 7 9 ;
i f ( c = = c h )
{c 1 = 2 1 8 ;
c 2 = 1 9 1 ;
c 3 = 2 1 7 ;c 4 = 2 1 7 ;
l 1 = 1 9 6 ;
l 2 = 1 7 9 ;
}
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 34/80
e l s e
{
c 1 = c ;c 2 = c ;
c 3 = c ;
c 4 = c ;l 1 = c ;
c 2 = c ;
}g o t o x y ( c o l u m n 1 , r o w 1 ) ;
c o u t < < c 1 ;
g o t o x y ( c o l u m n 2 , r o w 1 ) ;
c o u t < < c 2 ;g o t o x y ( c o l u m n 1 , r o w 2 ) ;
c o u t < < c 3 ;
g o t o x y ( c o l u m n 2 , r o w 2 ) ;
c o u t < < c 4 ;c o l u m n 1 + + ;
c o l u m n 2 - - ;l i n e _ h o r ( c o lu m n 1 , c o l u m n 2 , r o w 1 , l 1 ) ; / / H o r i z o n t a l l i n e
l i n e _ h o r ( c o lu m n 1 , c o l u m n 2 , r o w 2 , l 1 ) ;
c o l u m n 1 - - ;c o l u m n 2 + + ;
r o w 1 + + ;
r o w 2 - - ;
l i n e _ v e r ( r ow 1 , r o w 2 , c o l u m n 1 , l 2 ) ; / / V e r t i c a l l i n el i n e _ v e r ( r ow 1 , r o w 2 , c o l u m n 2 , l 2 ) ;
}
/ * F u n c t i o n t o d i s p l a y h e l p a b o u t t h i s p r o j e c t
T h i s h e l p f u n c t i o n i s t h e f i r s t s c r e e n o u t p u t d i s p l a y t o k n o w a b o u tt h e m e n u o p t i o n s a n d a b o u t t h e
b a n k i n g p r o j e c t * /
v o i d m a i n _ m e n u : :h e l p ( v o i d )
{c l r s c r ( ) ;
s e t b k c o l o r ( 7 ) ;s e t t e x t s t y l e ( 7 , H O R I Z _ D I R , 5 ) ;
o u t t e x t x y ( 7 0 , 2 0 , "W e l c o m e t o B a n k i n g P r o j e c t " ) ;
s e t t e x t s t y l e ( 2 , H O R I Z _ D I R , 5 ) ;o u t t e x t x y ( 6 0 , 1 0 0 , " T h i s p r o j e c t y o u r c a n k e e p r e c o r d o f d a i l y
b a n k i n g t r a n s a c t i o n " ) ;
d e l a y ( 2 ) ;
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 35/80
o u t t e x t x y ( 6 0 , 1 3 0 , " T h i s p r o g r a m i s c a p a b l e o f h o l d i n g a n y n o .
o f a c c o u n t . " ) ;
d e l a y ( 2 ) ;o u t t e x t x y ( 6 0 , 1 6 0 , " - I n f i r s t o p t i o n y o u c a n o p e n n e w a c c o u n t " ) ;
d e l a y ( 2 ) ;
o u t t e x t x y ( 6 0 , 1 9 0 , " - I n s e c o n d o p t i o n y o u c a n s e e t h e l i s t o f a l lt h e a c c o u n t s " ) ;
d e l a y ( 2 ) ;
o u t t e x t x y ( 6 0 , 2 2 0 ," - I n t h i r d o p t i o n y o u c a n s e e a l l t h et r a n s a c t io n o f i n d i v i d u a l a c c o u n t " ) ;
d e l a y ( 2 ) ;
o u t t e x t x y ( 6 0 , 2 5 0 , " - T h r o u g h f o u r t h o p t i i o n y o u c a n d o b a n k i n g
t r a n s a c t i o n s " ) ;d e l a y ( 2 ) ;
o u t t e x t x y ( 6 0 , 2 8 0 , " ( D e p o s i t / W i t h d r a w )" ) ;
d e l a y ( 2 ) ;
o u t t e x t x y ( 6 0 , 3 1 0 , " - I n f i f t h o p t i o n y o u c a n t a k e m o n t h W i s ei n d i v i d u a l a c c o u n t r e p o r t " ) ;
d e l a y ( 2 ) ;o u t t e x t x y ( 6 0 , 3 4 0 ," - I n s i x t h o p t i o n y o u c a n m o d i f y o r d e l e t e a n y
a c c o u n t " ) ;
d e l a y ( 2 ) ;o u t t e x t x y ( 6 0 , 3 7 0 , " N o t e - : O p e n i n g a m o u n t s h o u l d n o t l e s s t h a t
R s . 5 0 0 / - " ) ;
d e l a y ( 2 ) ;
o u t t e x t x y ( 6 0 , 4 0 0 , " - A n d l a s t o p t i o n i s Q u i t ( E x i t t o W i n d o w ) " ) ;d e l a y ( 2 ) ;
s e t t e x t s t y l e ( 7 , H O R I Z _ D I R , 4 ) ;o u t t e x t x y ( 8 0 , 4 2 0 ," P r e s s a n y k e y t o c o n t i n u e . . . " ) ;
g e t c h ( ) ;
}
/ * F u n c t i o n f o r m o d i f y i n g t h e e x i s t i n g a c c o u n t s
T h e m o d i f y ( ) f u n c t i o n i s u s e d t o m o d i f y a n e x i s t i n g a c c o u n t f o r i t sa d d r e s s p a r t o n l y
W h i l e m o d i f y i n g , a p r o m p t i s a l w a y s d i s p l a y s a s " D o y o u w a n t t o
s a v e c h a n g e < y / n > " m e a n si f y o u w i l l p r e s s ' y ' t h e n t h e c u r r e n t m e m o r y i n f o r m a t i o n w i l l
c h a n g e w i t h e x i s t i n g i n f o r m a t i o n
o t h e r W i se t h e p r e v i o u s i n f o r m a t i o n r e m a i n i n t a c t i n y o u r d a t a f i l e .W h i l e e n t e r i n g t h e n a m e a n d a d d r e s s t h e i r i s a p r o p e r v a l i d a t i o n a n d
a b l a n k c h e c k f a c i l i ty i s t h e r e ,
t o p r e v e n t m i s t a k e a n d m i s h a n d l i n g o f d a t a e t c . . * /
v o i d i n i t i a l : : m o d i f y ( v o i d )
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 36/80
{
c l r s c r ( ) ;
i n t j ;c h a r t _ a c c [ 1 0 ] ;
i n t t , t _ a c c n o ;
g o t o x y ( 1 7 , 1 ) ;c o u t < < " < 0 > = E x i t " ;
g o t o x y ( 5 , 5 ) ;
c o u t < < " E n t e r t h e a c c o u n t n o . " ;g e t s ( t _ a c c ) ;
t = a t o i ( t _ a c c ) ;
t _ a c c n o = t ;
i f ( t _ a c c n o = = 0 )r e t u r n ;
c l r s c r ( ) ;
i f ( ! f o u n d _ a c c o u n t( t _ a c c n o ) )
{ g o t o x y ( 5 , 5 ) ;
c o u t < < " \ 7 A c c o u n t n o t f o u n d " ;g e t c h ( ) ;
r e t u r n ;
}g o t o x y ( 7 1 , 1 ) ;
c o u t < < " < 0 > = E x i t " ;
t e x t b a c k g r o u n d ( W H I T E ) ;
g o t o x y ( 3 , 3 ) ;f o r ( j = 1 ; j < = 7 6 ; j + + )
c p r i n t f ( " " ) ;
t e x t b a c k g r o u n d ( B L A C K ) ;t e x t c o l o r ( B L A C K + B L I N K ) ;
t e x t b a c k g r o u n d ( W H I T E ) ;
g o t o x y ( 3 0 , 3 ) ;c p r i n t f ( " Mo d i f y A c c o u n t S c r e e n " ) ;
t e x t c o l o r ( L I G H T G R A Y ) ;
t e x t b a c k g r o u n d ( B L A C K ) ;
i n t d 1 , m 1 , y 1 ;s t r u c t d a t e d ; / / F o r e x t r a c t i n g s y s t e m d a t e
g e t d a t e ( & d ) ;
d 1 = d . d a _ d a y ;m 1 = d . d a _ m o n ;
y 1 = d . d a _ y e a r ;
g o t o x y ( 4 , 2 ) ;c o u t < < " D a t e : " < < d 1 < < " / " < < m 1 < < " / " < < y 1 ;
c h a r c h ;
d i s p l a y ( t _ a c c n o ) ;
a c c o u n t a ;
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 37/80
d o
{
a . c l e a r ( 5 , 1 3 ) ;g o t o x y ( 5 , 1 3 ) ;
c o u t < < " M o d i f y t h i s a c c o u n t < y / n > : " ;
c h = g e t c h e ( ) ;i f ( c h = = ' 0 ' )
r e t u r n ;
c h = t o u p p e r ( c h ) ;} w h i l e ( c h ! = ' N ' & & c h ! = ' Y ' ) ;
i f ( c h = = ' N ' )
r e t u r n ;
i n t m o d i f i e d = 0 , v a l i d ;c h a r t _ n a m e [ 3 0 ] , t _ a d d r e s s [3 0 ] ;
g o t o x y ( 5 , 1 5 ) ;
c o u t < < " N a m e : " ;
g o t o x y ( 5 , 1 6 ) ;c o u t < < " A d d r e s s : " ;
d o
{
a . c l e a r ( 1 5 , 1 5 ) ;a . c l e a r ( 5 , 2 3 ) ;
g o t o x y ( 5 , 2 3 ) ;
c o u t < < " E n t e r N a m e o r P r e s s E n t e r f o r N o C h a n g e " ;
v a l i d = 1 ;g o t o x y ( 1 5 , 1 5 ) ;
g e t s ( t _ n a m e ) ;
s t r u p r ( t _ n a m e ) ;i f ( t _ n a m e [ 0 ] = = ' 0 ' )
r e t u r n ;
i f ( s t r l e n ( t _ n a m e ) > 2 5 ){
v a l i d = 0 ;
g o t o x y ( 5 , 2 3 ) ;
c p r i n t f ( " \ 7 N a m e s h o u l d n o t g r e a t e r t h a n 2 5 " ) ;g e t c h ( ) ;
}
} w h i l e ( ! v a l i d ) ;
d o
{a . c l e a r ( 1 5 , 1 6 ) ;
a . c l e a r ( 5 , 2 3 ) ;
g o t o x y ( 5 , 2 3 ) ;
c o u t < < " E n t e r A d d r e s s o r p r e s s e n t e r f o r n o C h a n g e " ;
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 38/80
v a l i d = 1 ;
g o t o x y ( 1 5 , 1 6 ) ;
g e t s ( t _ a d d r e s s ) ;s t r u p r ( t _ a d d r e s s ) ;
i f ( t _ a d d r e s s [ 0 ] = = ' 0 ' )
r e t u r n ;i f ( s t r l e n ( t _ a d d r e s s ) > 2 5 )
{
v a l i d = 0 ;g o t o x y ( 5 , 2 3 ) ;
c p r i n t f ( " \ 7 A d d r e s s s h o u l d n o t g r e a t e r t h a n 2 5 " ) ;
g e t c h ( ) ;
}} w h i l e ( ! v a l i d ) ;
i f ( s t r l e n ( t _ a d d r e s s ) > 0 )
m o d i f i e d = 1 ;i f ( ! m o d i f i e d )
r e t u r n ;/ / c l e a r s t h e s c r e e n a t 2 3 r d r o w a n d f r o m 5 t h c o l u m n
a . c l e a r ( 5 , 2 3 ) ;
d o
{
a . c l e a r ( 5 , 2 3 ) ;
g o t o x y ( 5 , 1 8 ) ;c o u t < < " D o y o u w a n t t o s a v e C h a n g e s < Y / N > : " ;
c h = g e t c h e ( ) ;
i f ( c h = = ' 0 ' )r e t u r n ;
c h = t o u p p e r ( c h ) ;
} w h i l e ( c h ! = ' N ' & & c h ! = ' Y ' ) ;
i f ( c h = = ' N ' )
r e t u r n ;
/ / P a s s e s t h e p a r a m e t e r t o a d d i n d a t a f i l e
m o d i f y _ a c c o u n t ( t_ a c c n o , t _ n a m e , t _ a d d r e s s ) ;
g o t o x y ( 5 , 2 1 ) ;c o u t < < " \ 7 R e c o r d m o d i f i e d " ;
g o t o x y ( 5 , 2 3 ) ;
c o u t < < " P r e s s a n y k e y t o c o n t i n u e . . . " ;g e t c h ( ) ;
}
/ * F u n c t i o n f o r d i s p l a y i n g a n a c c o u n t w h e n m o d i f i e d
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 39/80
T h i s d i s p l a y ( ) f u n c t i o n i s u s e d t o d i s p l a y a l l t h e a c c o u n t h o l d e r s
a c c o u n t n o , n a m e , a d d r e s s , a n d
b a l a n c e a m o u n t a t s c r e e n .H e r e t h e f s t r e a m o b j e c t i s d e c l a r e d t o r e a d t h e d a t a f r o m
" I N I T I A L . d a t" d a t a f i l e i n i n p u t m o d e o n l y .
W h e n e v e r t h e r e i s r e c o r d i n d a t a f i l e , t h e r e a d ( ) s t a t e m e n t w i l l r e a dt h e r e c o r d s l i n e a r l y t i l l e n d - o f - f i l e . * /
v o i d i n i t i a l : : d i s p l a y ( i n t t _ a c c n o ){
f s t r e a m f i l e ;
f i l e . o p e n ( " IN I T I A L . d a t " , i o s : : i n ) ;
f i l e . s e e k g (0 , i o s : : b e g ) ;
/ / D i s p l a y s t h e r e c o r d c o n t e n t s m a t c h i n g w i t h t _ a c c n o f r o m
I N I T I A L . d a t d a t a f i l e
w h i l e ( f i l e . r e a d ( ( c h a r * ) t h i s , s i z e o f ( i n i t i a l ) ) ){
i f ( t _ a c c n o = = a c c n o ){
g o t o x y ( 8 , 5 ) ;
c o u t < < " A c c o u n t n o . " < < a c c n o ;g o t o x y ( 1 0 , 8 ) ;
c o u t < < " N a m e : " ;
p u t s ( n a m e ) ;
g o t o x y ( 1 0 , 9 ) ;c o u t < < " A d d r e s s : " ;
p u t s ( a d d r e s s ) ;
g o t o x y ( 1 0 , 1 0 ) ;c o u t < < " B a l a n c e : " < < s e t w ( 1 5 ) / / s e t w i d t h
< < s e t p r e c i s i o n ( 2 ) / / s e t p o s i t i o n
o f d e c i m a l p o i n t< < s e t i o s f l a g s ( i o s : : l e f t ) / / s e t l e f t
j u s t i f i e d o u t p u t
< < s e t i o s f l a g s ( i o s : : s h o w p o i n t ) / /
a l w a y s s h o w d e c i m a l p o i n t< < s e t i o s f l a g s ( i o s : : f i x e d ) / / s e t
f i x e d n o t a t i o n f o r d i s p l a y
< < b a l a n c e ; b r e a k ;
}
}f i l e . c l o s e ( ) ;
}
/ * F u n c t i o n f o r u p d a t i n g t h e m o d i f i e d a c c o u n t i n t o I N I T I A L . d a t f i l e
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 40/80
T h i s f u n c t i o n m o d i f y _ a c c o u n t ( ) r e c e i v e s n u m b e r p a r a m e t e r s s u c h a s ,
a c c o u n t n u m b e r , n a m e , a d d r e s s e t c , a n d
w i l l o v e r W r i t e a t t h e e x i s t i n g p l a c e i n t h e " I N I T I A L . d a t" d a t a f i l e .T h e m a i n l o g i c o f t h e f u n c t i o n i s t h a t , i t u s e s a f u n c t i o n c a l l e d
s e e k p ( l o c a t io n ) , w h i c h m e a n s t h a t
w h e n a p a r t i c u l a r r e c o r d i s t e n d s t o m o d i f y , f i r s t w e h a v e t o k n o wt h e r e c o r d p o s i t i o n a c c o r d i n g t o d a t a f i l e .
O n c e w e f i n d t h e p o s i t i o n ( l o c a t i o n ) t h e n , a s i n g l e v a l u e i s
d e c r e m e n t e d f r o m i t s o r i g i n a l l o c a t i o n a n d o v e r w r i t te nb y t h e s a m e o f s t r e a m c o m m a n d w r i t e i n t o t h e d a t a f i l e . * /
v o i d i n i t i a l : : m o d i fy _ a c c o u n t ( i n t t _ a c c n o , c h a r t _ n a m e [ 3 0 ] , c h a r
t _ a d d r e s s [ 3 0 ] ){
i n t r e c n o ;
r e c n o = r e c o r d n o ( t _ a c c n o ) ;
f s t r e a m f i l e ;f i l e . o p e n ( " IN I T I A L . d a t " , i o s : : o u t | i o s : : a t e ) ;
s t r c p y ( n a m e , t _ n a m e ) ;s t r c p y ( a d d r es s , t _ a d d r e s s ) ;
i n t l o c a t i o n ;
/ / f i n d s t h e p o s i t i o n i n d a t a f i l e
l o c a t i o n = ( r e c n o - 1 ) * s i z e o f ( i n i t i a l ) ;
f i l e . s e e k p ( l o c a t i o n ) ;
/ / O v e r w r i t e s t h e m o d i f i e d r e c o r d i n t o I N I T I A L . d a t d a t a f i l e
f i l e . w r i t e ( ( c h a r * ) t h i s , s i z e o f ( i n i t i a l ) ) ;
f i l e . c l o s e ( ) ;r e t u r n ;
}
/ * F u n c t i o n t o f i n d t h e l a s t a c c o u n t n u m b e r
T h i s i s a n i n t e r e s t i n g f u n c t i o n w h o i s c r e a t i n g t h e a c c o u n t n u m b e r
a u t o m a t i c a l l y .
A t t h e f i r s t m e m o m e n t w h e n t h e r e i s n o r e c o r d , t h e n e w a c c o u n tn u m b e r i s c r e a t e d a s 1 .
I f a n y a c c o u n t n u m b e r i s t h e r e t h e n , t h e f i l e w i l l t r a v e l a l l t h e
r e c o r d sa n d s t o r e t h e l a s t a c c o u n t n u m b e r w i t h a v a r i a b l e c o u n t . A t t h a t
s t a t e t h e f u n c t i o n r e t u r n t h e s a m e v a l u e
t h e c a l l e d p r o g r a m f o r a u t o m a t i c c o d e g e n e r a t i o n . * /i n t i n i t i a l : : l a s t _ a c c n o ( v o i d )
{
f s t r e a m f i l e ;
f i l e . o p e n ( " IN I T I A L . d a t " , i o s : : i n ) ;
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 41/80
f i l e . s e e k g (0 , i o s : : b e g ) ;
i n t c o u n t = 0 ;
/ / F o u n d s t h e l a s t a c c o u n t n o .
w h i l e ( f i l e . r e a d ( ( c h a r * ) t h i s , s i z e o f ( i n i t i a l ) ) )
c o u n t = a c c n o ;f i l e . c l o s e ( ) ;
r e t u r n c o u n t ;
}/ * T h i s f u n c t i o n a d d _ t o _ f i l e ( ) i s u s e d t o c r e a t e n e w / f r e s h r e c o r d i n
t h e d a t a f i l e , a n d t h e p a r a m e t e r s
i s t h e a c t u a l v a l u e w h i c h w i l l b e w r i t e i n t o t h e " I N I T I A L . d a t " f i l e .
E v e r y t i m e w h e n a n y a c c o u n tm a k e s t r a n s a c t i o n f o r e i t h e r W i t h d r a w ( W ) o r D e p o s i t ( D ) t h e
b a l a n c e a m o u n t w i l l m o d i f i e d i n t h e d a t a f i l e * /
v o i d i n i t i a l : : a d d _ t o _ f i l e ( i n t t _ a c c n o , c h a r t _ n a m e [ 3 0 ] , c h a r t _ a d d r e s s [ 3 0] , f l o a t t _ b a l a n c e )
{a c c n o = t _ a c c n o ;
s t r c p y ( n a m e , t _ n a m e ) ;
s t r c p y ( a d d r es s , t _ a d d r e s s ) ; b a l a n c e = t _ b a l a n c e ;
f s t r e a m f i l e ;
/ / A p p e n d s n e w a c c o u n t r e c o r d w i t h t h e b a l a n c e i n t oI N I T I A L . d a t d a t a f i l e
f i l e . o p e n ( " IN I T I A L . d a t " , i o s : : o u t | i o s : : a p p ) ;
f i l e . w r i t e ( ( c h a r * ) t h i s , s i z e o f ( i n i t i a l ) ) ;f i l e . c l o s e ( ) ;
}
/ / F u n c t i o n f o r d e l e t i n g a a c c o u n t f r o m I N I T I A L . d a t f i l e/ / T h i s f u n c t i o n i s u s e d t o d e l e t e a n y a c c o u n t f r o m d a t a f i l e . B y t h i s
f u n c t i o n
v o i d i n i t i a l : : d e l e t e _ a c c o u n t ( in t t _ a c c n o )
{f s t r e a m f i l e ;
f i l e . o p e n ( " IN I T I A L . d a t " , i o s : : i n ) ;
f s t r e a m t e m p ;t e m p . o p e n ( " T E M P . d at " , i o s : : o u t ) ;
f i l e . s e e k g ( 0 , i o s : : b e g ) ;
/ / U s e s a c o p y m e t h o d t o d e l e t e t h e a c c o u n t f r o m I N T I T A L . d a t
d a t a f i l e
w h i l e ( ! f i l e . e o f ( ) )
{
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 42/80
f i l e . r e a d ( ( c h a r * ) t h i s , s i z e o f ( i n i t i a l ) ) ;
i f ( f i l e . e o f ( ) )
b r e a k ;i f ( a c c n o ! = t _ a c c n o )
t e m p . w r i t e ( ( c h a r * ) t h i s , s i z e o f ( i n i t i a l ) ) ;
}f i l e . c l o s e ( ) ;
t e m p . c l o s e ( ) ;
f i l e . o p e n ( " IN I T I A L . d a t " , i o s : : o u t ) ;t e m p . o p e n ( " T E M P . d at " , i o s : : i n ) ;
t e m p . s e e k g ( 0 , i o s : : b e g ) ;
/ / C o p y t h e T E M P . d a t c o n t e n t s i n t o I N T I T A L . d a t d a t a f i l ew h i l e ( ! t e m p . e o f ( ) )
{
t e m p . r e a d ( ( c h a r * ) t h i s , s i z e o f ( i n i t i a l ) ) ;
i f ( t e m p . e o f ( ) ) b r e a k ;
i f ( a c c n o ! = t _ a c c n o )f i l e . w r i t e ( ( c h a r * ) t h i s , s i z e o f ( i n i t i a l ) ) ;
}
f i l e . c l o s e ( ) ;t e m p . c l o s e ( ) ;
}
/ * F u n c t i o n f o r a d d a n a c c o u n t d e t a i l s o f d a i l y t r a n a c t i o n i n t oB A N K I N G . d a t f i l e .
B y u s i n g t h e p a r a m e t e r s t h e i n f o r m a t i o n o f d a i l y t r a n s a c t i o n
a p p e n d e d i n t o " B A N K I N G . d a t"d a t a f i l e i n c l u d i n g a m o u n t t r a n s a c t i o n a n d t h e c u r r e n t b a l a n c e v a l u e .
* /
v o i d a c c o u n t : : a d d _ t o _ f i le ( i n t t _ a c c n o , i n t d 1 , i n t m 1 , i n t y 1 , c h a r t _ t r a n , c h a r t _ t y p e [ 1 0 ] , f l o a t t _ i n t e r e s t , f l o a t t _ a m o u n t , f l o a t
t _ b a l a n c e )
{
f s t r e a m f i l e ;f i l e . o p e n ( " B AN K I N G . d a t " , i o s : : a p p ) ;
a c c n o = t _ a c c n o ;
g e t c h ( ) ;d d = d 1 ;
m m = m 1 ;
y y = y 1 ;t r a n = t _ t r a n ;
s t r c p y ( t y p e , t _ t y p e ) ;
i n t e r e s t = t _ i n t e r e s t ;
a m o u n t = t _ a m o u n t ;
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 43/80
b a l a n c e = t _ b a l a n c e ;
/ / A p p e n d s t h e t r a n s a c t i o n r e c o r d i n t o B A N K I N G . d a t d a t a f i l ef i l e . w r i t e ( ( c h a r * ) t h i s , s i z e o f ( a c c o u n t ) ) ;
f i l e . c l o s e ( ) ;
}/ * F u n c t i o n f o r d e l e t i n g a n a c c o u n t f r o m B A N K I N G . d a t f i l e . T h i s i s
a c o p y m e t h o d l i k e , w h e n t h e u s e r w i l l i n p u t a n y a c c c o u n t n o ,
t h e s a m e a c c o u n t n o . w i l l c h e c k e d i n t h e " B A N K I N G . d a t" f i l e , i f t h ea c c o u n t n o . m a t c h e d i n y o u r d a t a f i l e t h e n , i t w i l l r e m a i n i n
y o u r d a t a f i l e o t h e r w i s e o t h e r r e m a i n i n g r e c o r d s w i l l t r a n s f e r r e d
i n t o " T E M P . d a t " d a t a f i l e . S o , y o u r n e w " T E M P . d a t " f i l e h o l d s a l l
t h e r e c o r d s e x e c e p t i n p u t e d a c c o u n t n o . O n t h e s a m e w a y m a k e c o p yo f a l l t h e " T E M P . d a t " r e c o r d s b a c k i n t o y o u r " B A N K I N G . d a t " f i l e
f o r r e s t o r i n g t h a t y o u r d a t a f i l e d e l e t e s t h e m a t c h e d a c c o u n t n o . * /
v o i d a c c o u n t : : d e l e te _ a c c o u n t ( i n t t _ a c c n o ){
f s t r e a m f i l e ;f i l e . o p e n ( " B AN K I N G . d a t " , i o s : : i n ) ; / / O p e n t o r e a d r e c o r d s
f s t r e a m t e m p ;
t e m p . o p e n ( " T E M P . d at " , i o s : : o u t ) ; / / O p e n t o w r i t e r e c o r d sf i l e . s e ek g ( 0 , i o s : :b eg ) ; / / P os i t io n e d f r om be g i n i ng o f t he
f i l e
/ / U s e s t h e c o p y m e t h o d f o r d e l e t i n g t h e t r a n s a c t i o n r e c o r df r o m B A N K I N G . d a t d a t a f i l e
w h i l e ( ! f i l e . e o f ( ) )
{f i l e . r e a d ( (c h a r * ) t h i s , s i z e o f ( a c co u n t ) ) ;
i f ( f i l e . e o f ( ) )
b r e a k ;i f ( a c c n o ! = t _ a c c n o )
t e m p . w r i t e ( ( c h a r * ) t h i s , s i z e o f ( a c c o u n t ) ) ;
}
f i l e . c l o s e ( ) ;t e m p . c l o s e ( ) ;
f i l e . o p e n ( " B AN K I N G . d a t " , i o s : : o u t ) ;
t e m p . o p e n ( " T E M P . d at " , i o s : : i n ) ;t e m p . s e e k g ( 0 , i o s : : b e g ) ;
/ / U s e s c o p y m e t h o d t o t r a n s f e r t h e r e c o r d f r o m T E M P . d a t f i l et o B A N K I N G . d a t d a t a f i l e
w h i l e ( ! t e m p . e o f ( ) )
{
t e m p . r e a d ( ( ch a r * ) t h i s , s i z e o f ( a c co u n t ) ) ;
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 44/80
i f ( t e m p . e o f ( ) )
b r e a k ;
i f ( a c c n o ! = t _ a c c n o )f i l e . w r i t e ( ( c h a r * ) t h i s , s i z e o f ( a c c o u n t ) ) ;
}
f i l e . c l o s e ( ) ;t e m p . c l o s e ( ) ;
}
/ * F u n c t i o n f o r d i s p l a y i n g a n a c c o u n t f r o m " I N I T I A L . d a t " . T h i s
f u n c t i o n s h o w s a l l a c c o u n t h o l d e r s
d a t a r e c o r d s a n d t h e i r r e s p e c t i v e c u r r e n t b a l a n c e a m o u n t a t s c r e e n .
T h u s , t h e b a n k w i l l b e a p o s i t i o n t o k n o wt h a t t h e r e i s a p a r t i c u l a r s u m i s a v a i l a b l e i n b a n k . T h u s , t h e t o t a l
b a l a n c e i n b a n k c a n e a s i l y r e a l i s e d o r s t a t u s
o f th e b a n k c a n k n o w n i n t h e m a n a g e m e n t * /
v o i d i n i t i a l : : d i s p l a y _ l i s t ( v o i d ){
c l r s c r ( ) ;i n t f l a g ;
f l o a t t _ b a l = 0 . 0 ;
f s t r e a m f i l e ;g o t o x y ( 2 5 , 2 ) ;
c o u t < < " A c c o u n t s L i s t i n B a n k " ;
g o t o x y ( 2 5 , 3 ) ;c o u t < < " = = = = = = = = = = == = = = = = = = = = " ;
i n t d 1 , m 1 , y 1 ;
s t r u c t d a t e d ; / / F o r e x t r a c t i n g s y s t e m d a t eg e t d a t e ( & d ) ;
d 1 = d . d a _ d a y ;
m 1 = d . d a _ m o n ;y 1 = d . d a _ y e a r ;
g o t o x y ( 6 2 , 3 ) ;
c o u t < < " D a t e : " < < d 1 < < " / " < < m 1 < < " / " < < y 1 ;
g o t o x y ( 1 , 4 ) ;f o r ( i n t j = 1 ; j < = 7 9 ; j + + )
c o u t < < " = " ;
g o t o x y ( 1 , 5 ) ;
c o u t < < " A c c n o # " ;
g o t o x y ( 1 0 , 5 ) ;c o u t < < " N a m e " ;
g o t o x y ( 3 0 , 5 ) ;
c o u t < < " A d d r e s s " ;
g o t o x y ( 6 5 , 5 ) ;
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 45/80
c o u t < < " B a l a n c e " ;
g o t o x y ( 1 , 6 ) ;
f o r ( j = 1 ; j < = 7 9 ; j + + )c o u t < < " = " ;
f i l e . o p e n ( " IN I T I A L . d a t " , i o s : : i n ) ;
f i l e . s e e k g ( 0 , i o s : : b e g ) ;i n t r o w = 7 ;
/ / R e a d s a l l t h e r e c o r d s t o d i s p l a y o n t h e s c r e e nw h i l e ( f i l e . r e a d ( ( c h a r * ) t h i s , s i z e o f ( i n i t i a l ) ) )
{
f l a g = 0 ;
d e l a y ( 2 ) ;g o t o x y ( 3 , r o w ) ;
c o u t < < a c c n o ;
g o t o x y ( 1 0 , r o w ) ;
p u t s ( n a m e ) ;g o t o x y ( 3 0 , r o w ) ;
p u t s ( a d d r e s s ) ;g o t o x y ( 6 5 , r o w ) ;
c o u t < < s e t w ( 1 5 )< < s e t p r e c i s i o n ( 2 )
< < s e t i o s f l a g s ( i o s : : l e f t )
< < s e t i o s f l a g s ( i o s : : s h o w p o i n t )
< < s e t i o s f l a g s ( i o s : : f i x e d )< < b a l a n c e ;
t _ b a l = t _ b a l + b a l a n c e ;
r o w + + ;i f ( r o w > 2 3 )
{
f l a g = 1 ;r o w = 6 ;
g o t o x y ( 4 , 2 4 ) ;
c o u t < < " P r e s s a n y k e y t o c o n t i n u e . . . . " ;
g e t c h ( ) ;c l r s c r ( ) ;
}
}
g o t o x y ( 1 , r o w ) ;
f o r ( j = 1 ; j < = 7 9 ; j + + )c o u t < < " = " ;
r o w + + ;
g o t o x y ( 3 , r o w ) ;
c o u t < < " T o t a l B a l a n c e i n B a n k i s : " ;
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 46/80
g o t o x y ( 6 5 , r o w ) ;
c o u t < < s e t w ( 1 5 )< < s e t p r e c i s i o n ( 2 )
< < s e t i o s f l a g s ( i o s : : l e f t )
< < s e t i o s f l a g s ( i o s : : s h o w p o i n t )< < s e t i o s f l a g s ( i o s : : f i x e d )
< < t _ b a l ;
f i l e . c l o s e ( ) ;
i f ( ! f l a g )
{
g o t o x y ( 4 , 2 4 ) ;c o u t < < " P r e s s a n y k e y t o c o n t i n u e . . . " ;
g e t c h ( ) ;
}
}
/ * F u n c t i o n f o r c l e a r i n g s p e c i f i e d r o w a n d c o l u m n . B y u s i n g t h i sf u n c t i o n y o u c a n c l e a r f r o m a s p e c i f i e d r o w a n d c o l u m n
f r o m y o u r s c r e e n . H e r e t h e f u n c t i o n u t i l i z e s t w o p a r a m e t e r f o r
c l e a r i n g t h e r o w a n d c o l u m n . * /v o i d a c c o u n t : : c l e a r ( i n t c o l , i n t r o w )
{
f o r ( i n t j = c o l ; j < = 7 9 ; j + + )
{g o t o x y ( j , r o w ) ;
c o u t < < " " ;
}}
/ * F u n c t i o n t o f o u n d a n a c c o u n t f o r d i s p l a y a c c o u n t f u n c t i o n . T h i sf u n c t i o n i s u s e d t o f o u n d a n y a c c o u n t
i n t h e " I N I T I A L . d a t " d a t a f i l e , w h e r e t h e f i l e i s s e a r c h e d f r o m t h e
b e g i n n i n g p o s i t i o n a n d s e a r c h
w h e a t h e r t h e e n t e r e d a c c o u n t e x i s t o r n o t . I f e x i s t t h e n t h e f o u n dv a r i a b l e w i l l r e t u rn a v a l u e 1 o r r e t u r n 0 a s
t h e p a r a m e t e r * /
i n t i n i t i a l : : f o u n d _ a c c o u n t ( i n t t _ a c c n o ){
f s t r e a m f i l e ;
f i l e . o p e n ( " IN I T I A L . d a t " , i o s : : i n ) ;f i l e . s e e k g (0 , i o s : : b e g ) ;
i n t f o u n d = 0 ;
/ / S e a r c h e s t h e s p e c i f i e d r e c o r d i n I N I T I A L . d a t d a t a f i l e
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 47/80
w h i l e ( f i l e . r e a d ( ( c h a r * ) t h i s , s i z e o f ( i n i t i a l ) ) )
{
i f ( a c c n o = = t _ a c c n o ){
f o u n d = 1 ;
b r e a k ;}
}
f i l e . c l o s e ( ) ;r e t u r n f o u n d ;
}
/ * F u n c t i o n f o r r e t u r n n a m e o f t h e a c c o u n t h o l d e r f r o m I N I T I A L . d a t .T h i s f u n c t i o n
b a s i c a l l y u s e d t o r e t u r n o n l y n a m e o f t h e a c c o u n t h o l d e r i f t h e
a c c o u n t i n t h e " I N I T I A L . d a t"
d a t a f i l e . W h e n t h e n a m e w i l l r e t u r n e d i t m a y s i m p l y d i s p l a y /m o d i f y a t o t h e r f u n c t i o n s * /
c h a r * i n i t i a l : : r e t u r n _ n a m e (i n t t _ a c c n o ){
f s t r e a m f i l e ;
f i l e . o p e n ( " IN I T I A L . d a t " , i o s : : i n ) ;f i l e . s e e k g (0 , i o s : : b e g ) ;
c h a r t _ n a m e [ 3 0 ] ;
/ / R e t u r n t h e n a m e t o d i s p l a y a t r e p o r t s c r e e n i f f o u n dw h i l e ( f i l e . r e a d ( ( c h a r * ) t h i s , s i z e o f ( i n i t i a l ) ) )
{
i f ( a c c n o = = t _ a c c n o ){
s t r c p y ( t _ na m e , n a m e ) ;
b r e a k ;}
}
f i l e . c l o s e ( ) ;
r e t u r n t _ n a m e ;}
/ * F u n c t i o n f o r r e t u r n a d d r e s s o f t h e a c c o u n t h o l d e r f r o mI N I T I A L . d a t . T h i s f u n c t i o n
b a s i c a l l y u s e d t o r e t u r n o n l y a d d r e s s o f t h e a c c o u n t h o l d e r i f t h e
a c c o u n t i n t h e " I N I T I A L . d a t"d a t a f i l e . W h e n t h e a d d r e s s w i l l r e t u r n e d i t m a y s i m p l y d i s p l a y /
m o d i f y a t o t h e r f u n c t i o n s * /
c h a r * i n i t i a l : : r e t u r n _ a d d r es s ( i n t t _ a c c n o )
{
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 48/80
f s t r e a m f i l e ;
f i l e . o p e n ( " IN I T I A L . d a t " , i o s : : i n ) ;
f i l e . s e e k g (0 , i o s : : b e g ) ;c h a r t _ a d d r e s s [ 3 0 ] ;
/ / R e t u r n t h e a d d r e s s t o d i s p l a y a t r e p o r t s c r e e n i f f o u n dw h i l e ( f i l e . r e a d ( ( c h a r * ) t h i s , s i z e o f ( i n i t i a l ) ) )
{
i f ( a c c n o = = t _ a c c n o ){
s t r c p y ( t _ ad d r e s s , a d d r e s s ) ;
b r e a k ;
}}
f i l e . c l o s e ( ) ;
r e t u r n t _ a d d r e s s ;
}
/ * F u n c t i o n f o r d i s p l a y a c c o u n t d e t a i l s a s : T h i s f u n c t i o n d i s p l a y s t h eh e a d i n g a n d t h e a c c o u n t n o . n a m e , a d d r e s s a n d c u r r e n t d a t e
o n t h e s c r e e n w i t h o t h e r f u n c t i o n l i k e d i s p l a y _ a c c o u n t ( ) ,
m o n t h _ r e p o r t ( ) e t c . . A l s o t h e s a m e f u n c t i o n r e t u r n s t h e a c c o u n th o l d e r s
n a m e a n d a d d r e s s b y u s i n g t w o p o i n t e r t y p e f u n c t i o n l i k e
r e t u r n _ n a m e () a n d r e t u r n _ a d d r e ss ( ) . * /
v o i d a c c o u n t : : b o x _ fo r _ d i s p l a y ( i n t t _ a c c n o ){
i n t d 1 , m 1 , y 1 ;
s t r u c t d a t e d ;g e t d a t e ( & d ) ;
d 1 = d . d a _ d a y ;
m 1 = d . d a _ m o n ;y 1 = d . d a _ y e a r ;
g o t o x y ( 6 3 , 2 ) ;
c o u t < < " D a t e : " < < d 1 < < " / " < < m 1 < < " / " < < y 1 ;
g o t o x y ( 4 , 2 ) ;c o u t < < " A c c o u n t N o . " < < t _ a c c n o ;
i n i t i a l i n i ;
c h a r t _ n a m e [ 3 0 ] ;
s t r c p y ( t _ n a me , i n i . r e t u r n _ n am e ( t _ a c c n o ) ) ;
c h a r t _ a d d r e s s [ 3 0 ] ;
s t r c p y ( t _ a d dr e s s , i n i . r e t u r n_ a d d r e s s ( t _ a c cn o ) ) ;
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 49/80
g o t o x y ( 2 5 , 2 ) ;
c o u t < < t _ n a m e ;
g o t o x y ( 2 5 , 3 ) ;c o u t < < t _ a d d r e s s ;
g o t o x y ( 4 , 5 ) ;
c o u t < < " G l o b a l R e p o r t o f A c c o u n t " ;t e x t b a c k g r o u n d ( W H I T E ) ;
t e x t c o l o r ( B L A C K ) ;
t e x t b a c k g r o u n d ( W H I T E ) ;g o t o x y ( 1 , 6 ) ;
f o r ( i n t i = 1 ; i < = 7 9 ; i + + )
c o u t < < " = " ;
g o t o x y ( 4 , 7 ) ;c p r i n t f ( " D at e P a r t i c u l a r D e p o s i t W i t h d r a w
B a l a n c e " ) ;
g o t o x y ( 1 , 8 ) ;
f o r ( i = 1 ; i < = 7 9 ; i + + )c o u t < < " = " ;
t e x t c o l o r ( L I G H T G R A Y ) ;t e x t b a c k g r o u n d ( B L A C K ) ;
}
/ * F u n c t i o n f o r d i s p l a y a n a c c o u n t f r o m B A N K I N G . d a t f i l e . T h i s i s a
f u n c t i o n w h o d i s p l a y s
a l l t h e t r a n s a c t i o n o f a n y a c c o u n t o n s c r e e n . A n d t h e f u n c t i o n s h o w
t h e a c c o u n t n o . n a m e , a n d a d d r e s st h r o u g h t h e f u n c t i o n b o x _ f o r _ d i s p l a y ( ) . A l s o t h r o u g h t h i s f u n c t i o n
i t s h o w s t h e t o t a l d e p o s i t , t o t a l w i t h d r a w
a n d c u r r e n t b a l a n c e a m o u n t g l o b a l l y . * /v o i d a c c o u n t : : d i sp l a y _ a c c o u n t ( v o i d )
{
c l r s c r ( ) ;c h a r t _ a c c [ 1 0 ] ;
i n t j ;
i n t t a m t = 0 , d a m t = 0 , w a m t = 0 ;
i n t t , t _ a c c n o ;g o t o x y ( 7 1 , 1 ) ;
c o u t < < " < 0 > = E x i t " ;
g o t o x y ( 5 , 5 ) ;c o u t < < " E n t e r a c c o u n t n o . " ;
g e t s ( t _ a c c ) ;
t = a t o i ( t _ a c c ) ;t _ a c c n o = t ;
i f ( t _ a c c n o = = 0 )
r e t u r n ;
c l r s c r ( ) ;
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 50/80
i n i t i a l i n i ;
i f ( ! i n i . f o u nd _ a c c o u n t ( t _ a c c n o ) )
{g o t o x y ( 5 , 5 ) ;
c o u t < < " \ 7 A c c o u n t n o t f o u n d " ;
g e t c h ( ) ;r e t u r n ;
}
/ / D i s p l a y t h e h e a d i n g f r o m t h i s f u n c t i o n
b o x _ f o r _ d i s p l a y ( t _ a c c n o ) ;
i n t r o w = 9 , f l a g ;f s t r e a m f i l e ;
f i l e . o p e n ( " B AN K I N G . d a t " , i o s : : i n ) ;
w h i l e ( f i l e . r e ad ( ( c h a r * ) t h i s , s i z e o f ( a c c o u n t ) ) )
{ i f ( a c c n o = = t _ a c c n o )
{f l a g = 0 ;
d e l a y ( 2 ) ;
g o t o x y ( 4 , r o w ) ;c o u t < < d d < < " - " < < m m < < " - " < < y y ;
g o t o x y ( 1 6 , r o w ) ;
p u t s ( t y p e ) ;
i f ( t r a n = = ' D ' ){
d a m t = d a m t + a m o u n t ;
t a m t = t a m t + a m o u n t ;g o t o x y ( 3 0 , r o w ) ;
}
e l s e{
w a m t = w a m t + a m o u n t ;
t a m t = t a m t - a m o u n t ;
g o t o x y ( 4 2 , r o w ) ;}
c o u t < < s e t w ( 1 5 )< < s e t p r e c i s io n ( 2 )
< < s e t i o s f l a g s ( i o s : : l e f t )
< < s e t i o s f l a g s ( i o s : : s h o w p o i n t )< < s e t i o s f l a g s ( i o s : : f i x e d )
< < a m o u n t ;
g o t o x y ( 6 6 , r o w ) ;
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 51/80
c o u t < < s e t w ( 1 5 )
< < s e t p r e c i s io n ( 2 )
< < s e t i o s f l a g s ( i o s : : l e f t )< < s e t i o s f l a g s ( i o s : : s h o w p o i n t )
< < s e t i o s f l a g s ( i o s : : f i x e d )
< < b a l a n c e ;
r o w + + ;
i f ( r o w > 2 3 ){
f l a g = 1 ;
r o w = 7 ;
g o t o x y ( 4 , 2 4 ) ;c o u t < < " P r e s s a n y k e y t o c o n t i n u e " ;
g e t c h ( ) ;
c l r s c r ( ) ;
b o x _ f o r _ d i s p l a y ( t _ a c c n o ) ;}
}}
f i l e . c l o s e ( ) ;
g o t o x y ( 1 , r o w ) ;f o r ( j = 1 ; j < = 7 9 ; j + + )
c o u t < < " = " ;
r o w + + ;
g o t o x y ( 4 , r o w ) ;c o u t < < " T o t a l - - > :" ;
g o t o x y ( 3 0 , r o w ) ;
c o u t < < s e t w ( 1 5 )< < s e t p r e c i s io n ( 2 )
< < s e t i o s f l a g s ( i o s : : l e f t )
< < s e t i o s f l a g s ( i o s : : s h o w p o i n t )< < s e t i o s f l a g s ( i o s : : f i x e d )
< < d a m t ;
g o t o x y ( 4 2 , r o w ) ;
c o u t < < s e t w ( 1 5 )< < s e t p r e c i s i o n ( 2 )
< < s e t i o s f l a g s ( i o s : : l e f t )
< < s e t i o s f l a g s ( i o s : : s h o w p o i n t )< < s e t i o s f l a g s ( i o s : : f i x e d )
< < w a m t ;
g o t o x y ( 6 6 , r o w ) ;c o u t < < s e t w ( 1 5 )
< < s e t p r e c i s i o n ( 2 )
< < s e t i o s f l a g s ( i o s : : l e f t )
< < s e t i o s f l a g s ( i o s : : s h o w p o i n t )
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 52/80
< < s e t i o s f l a g s ( i o s : : f i x e d )
< < t a m t ;
i f ( ! f l a g ){
g o t o x y ( 4 , 2 4 ) ;
c o u t < < " P r e s s a n y k e y t o c o n t i n u e . . . " ;g e t c h ( ) ;
}
}
/ * F u n c t i o n t o l i s t m o n t h W i s e t r a n s a c t i o n r e p o r t . T h i s i s a
m o n t h w i s e s t a t u s r e p o r t f o r a n y
a c c o u n t , a n d t h e u s e r h a s t o f e e d o n l y a n y d a t e o f a n y m o n t h a n d t h ea c c o u n t n o . W h e n t h e d a t e
a n d a c c o u n t n o . e n t e r e d t h e f u n c t i o n w i l l c h e c k a l l t h e t r a n s a c t i o n s
o f p r e v i o u s m o n t h o f y o u r e n t e r e d d a t e
a n d f i n d t h e p r e v i o u s b a l a n c e i n t h e v a r i a b l e p r e _ b a l a n c e , w h i c h w i l l b e t h e " B / F . . . . . . " a m o u n t f o r r e p o r t i n g m o n t h .
T h e n , f r o m t h a t p e r i o d a l l r e m a i n i n g t r a n s a c t i o n s o f t h e s a m ee n t e r e d m o n t h w i l l d i s p l a y o n y o u r s c r e e n . * /
v o i d a c c o u n t : : m o n th _ r e p o r t ( v o i d ){
i n t d d 1 , m m 1 , y y 1 ;
c l r s c r ( ) ;g o t o x y ( 1 0 , 5 ) ;
c o u t < < " E n t e r a n y d a t e o f a m o n t h " ;
g o t o x y ( 3 8 , 5 ) ;c i n > > d d 1 ;
g o t o x y ( 4 0 , 5 ) ;
c o u t < < " - " ;g o t o x y ( 4 1 , 5 ) ;
c i n > > m m 1 ;
g o t o x y ( 4 3 , 5 ) ;
c o u t < < " - " ;g o t o x y ( 4 4 , 5 ) ;
c i n > > y y 1 ;
c l r s c r ( ) ;c h a r t _ a c c [ 1 0 ] ;
i n t j ;
i n t t a m t = 0 , d a m t = 0 , w a m t = 0 ;i n t t , t _ a c c n o ;
g o t o x y ( 7 1 , 1 ) ;
c o u t < < " < 0 > = E x i t " ;
g o t o x y ( 5 , 5 ) ;
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 53/80
c o u t < < " E n t e r a c c o u n t n o . " ;
g e t s ( t _ a c c ) ;
t = a t o i ( t _ a c c ) ;t _ a c c n o = t ;
i f ( t _ a c c n o = = 0 )
r e t u r n ;c l r s c r ( ) ;
i n i t i a l i n i ;
i f ( ! i n i . f o u nd _ a c c o u n t ( t _ a c c n o ) ){
g o t o x y ( 5 , 5 ) ;
c o u t < < " \ 7 A c c o u n t n o t f o u n d " ;
g e t c h ( ) ;r e t u r n ;
}
b o x _ f o r _ d i s p l a y ( t _ a c c n o ) ;
g o t o x y ( 4 , 5 ) ;c o u t < < " S t a t e m e n t M o n t h : " < < d d 1 < < " / " < < m m 1 < < " / " < <
y y 1 ;g e t c h ( ) ;
i n t r o w = 9 , f l a g ;f s t r e a m f i l e ;
f i l e . o p e n ( " B AN K I N G . d a t " , i o s : : i n ) ;
f l o a t p r e _ b a l a n c e = 0 . 0 ; / / P r e v i o u s b a l a n c e a m o u n t
/ / T h e l o o p f i n d s t h e l a s t m o n t h s b a l a n c e
w h i l e ( f i l e . r e ad ( ( c h a r * ) t h i s , s i z e o f ( a c c o u n t ) ) )
{/ / C h e c k s t h e a c c o u n t n o . a n d t i l l t h e p r e v i o u s m o n t h a n d
t i l l c u r r e n t y e a r
i f ( ( a c c n o = = t _ a c c n o ) & & ( ( m m < m m 1 & & y y < = y y 1 ) | |( m m 1 < m m & & y y < y y 1 ) ) )
{
p r e _ b a l a n c e = b a l a n c e ;
}}
f i l e . c l o s e ( ) ;f i l e . o p e n ( " B AN K I N G . d a t " , i o s : : i n ) ;
g o t o x y ( 5 4 , r o w ) ;
c o u t < < " B / F . . . . " < < s e t w ( 1 5 )
< < s e t p r e c i s io n ( 2 )
< < s e t i o s f l a g s ( i o s : : l e f t )
< < s e t i o s f l a g s ( i o s : : s h o w p o i n t )
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 54/80
< < s e t i o s f l a g s ( i o s : : f i x e d )
< < p r e _ b a l a n c e ;
r o w + + ;
/ / T h e l o o p d i s p l a y s t h e c u r r e n t m o n t h s t r a n s a c t i o n a f t e r
p r e v i o u s m o n t hw h i l e ( f i l e . r e ad ( ( c h a r * ) t h i s , s i z e o f ( a c c o u n t ) ) )
{
i f ( ( a c c n o = = t _ a c c n o ) & & ( m m 1 = = m m & & y y 1 < = y y ) ){
f l a g = 0 ;
d e l a y ( 2 ) ;
g o t o x y ( 4 , r o w ) ;c o u t < < d d < < " - " < < m m < < " - " < < y y ;
g o t o x y ( 1 6 , r o w ) ;
p u t s ( t y p e ) ;
i f ( t r a n = = ' D ' ){
d a m t = d a m t + a m o u n t ;t a m t = t a m t + a m o u n t ;
g o t o x y ( 3 0 , r o w ) ;
}e l s e
{
w a m t = w a m t + a m o u n t ;
t a m t = t a m t - a m o u n t ;g o t o x y ( 4 2 , r o w ) ;
}
c o u t < < s e t w ( 1 5 )
< < s e t p r e c i s io n ( 2 )
< < s e t i o s f l a g s ( i o s : : l e f t )< < s e t i o s f l a g s ( i o s : : s h o w p o i n t )
< < s e t i o s f l a g s ( i o s : : f i x e d )
< < a m o u n t ;
g o t o x y ( 6 6 , r o w ) ;
c o u t < < s e t w ( 1 5 )
< < s e t p r e c i s io n ( 2 )< < s e t i o s f l a g s ( i o s : : l e f t )
< < s e t i o s f l a g s ( i o s : : s h o w p o i n t )
< < s e t i o s f l a g s ( i o s : : f i x e d )< < b a l a n c e ;
r o w + + ;
/ / I f r o w i n c r e a s e s 2 3 t h e n t h e n e x t s c r e e n c o n t i n u e s
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 55/80
i f ( r o w > 2 3 )
{
f l a g = 1 ;r o w = 7 ;
g o t o x y ( 4 , 2 4 ) ;
c o u t < < " P r e s s a n y k e y t o c o n t i n u e " ;g e t c h ( ) ;
c l r s c r ( ) ;
b o x _ f o r _ d i s p l a y ( t _ a c c n o ) ;}
}
}
f i l e . c l o s e ( ) ;g o t o x y ( 1 , r o w ) ;
f o r ( j = 1 ; j < = 7 9 ; j + + )
c o u t < < " = " ;
r o w + + ;
g o t o x y ( 4 , r o w ) ;c o u t < < " T o t a l - - > :" ;
g o t o x y ( 3 0 , r o w ) ;
/ / D e p o s i t e d a m o u n t
c o u t < < s e t w ( 1 5 ) / / s e t w i d t h
< < s e t p r e c i s i o n ( 2 ) / / s e t p o s i t i o n o f d e c i m a l p o i n t
< < s e t i o s f l a g s ( i o s : : l e f t ) / / s e t l e f t j u s t i f i e d o u t p u t< < s e t i o s f l a g s ( i o s : : s h o w p o i n t ) / / a l w a y s s h o w d e c i m a l
p o i n t
< < s e t i o s f l a g s ( i o s : : f i x e d ) / / s e t f i x e d n o t a t i o n f o r d i s p l a y
< < d a m t ;
g o t o x y ( 4 2 , r o w ) ;
/ / W i t h d r a w a m o u n t
c o u t < < s e t w ( 1 5 )
< < s e t p r e c i s i o n ( 2 )< < s e t i o s f l a g s ( i o s : : l e f t )
< < s e t i o s f l a g s ( i o s : : s h o w p o i n t )
< < s e t i o s f l a g s ( i o s : : f i x e d )< < w a m t ;
g o t o x y ( 6 6 , r o w ) ;t a m t = t a m t + p r e _ b a l a n c e ;
/ / B a l a n c e a m o u n t
c o u t < < s e t w ( 1 5 )
< < s e t p r e c i s i o n ( 2 )
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 56/80
< < s e t i o s f l a g s ( i o s : : l e f t )
< < s e t i o s f l a g s ( i o s : : s h o w p o i n t )
< < s e t i o s f l a g s ( i o s : : f i x e d )< < t a m t ;
i f ( ! f l a g ){
g o t o x y ( 4 , 2 4 ) ;
c o u t < < " P r e s s a n y k e y t o c o n t i n u e . . . " ;g e t c h ( ) ;
}
}
/ * F u n c t i o n f o r c r e a t i n g n e w a c c o u n t f o r n e w c u s t o m e r . T h i s i s a
v e r y i m p o r t a n t f u n c t i o n
w h i c h u s e d t o c r e a t e n e w a c c o u n t w i t h a l l t h e d e t a i l s o f t h ec u s t o m e r . T h i s f u n c t i o n u s e d n u m b e r
m e m b e r f u n c t i o n l i k e l a s t _ a c c n o ( ) , a d d _ t o _ f i l e ( ) , d e l e t e _ a c c o u n t e t c .T h e l a s t _ a c c n o ( ) f u n c t i o n w i l l c r e a t e
a a u t o m a t i c a c c o u n t n o . a f t e r c h e c k i n g f r o m t h e " I N I T I A L . d a t " f i l e .
H e r e t h e a c c o u n t n u m b e r s s t a r t e d f r o m 1 o n w a r d s i f i t i s t h ef i r s t r e c o r d .
A l s o i n t h i s f u n c t i o n t h e v a l i d a t i o n c h e c k i n g o c c u r s t o t h e n a m e ,
a d d r e s s , v e r i f y i n g p e r s o n a n d i n i t i a l d e p o s i t a m o u n t . A t t h e t i m e o f
v a l i d a t i o n c h e c k i n gt h e n a m e a n d a d d r e s s s h o u l d n o t b l a n k a n d n o t m o r e t h a n t h e
s p e c i f i e d l e n g t h . A n d t h e i n i t i a l d e p o s i t a m o u n t n o t l e s s t h a n R s .
5 0 0 / - . * /
v o i d a c c o u n t : : n e w _ a c c o u nt ( v o i d )
{c h a r c h ;
i n t i , v a l i d ;
c l r s c r ( ) ;
i n i t i a l i n i ;
s h a p e s ;
s . b o x ( 2 , 1 , 7 9 , 2 5 , 2 1 8 ) ;s . b o x ( 2 5 , 2 , 5 4 , 4 , 2 1 9 ) ;
g o t o x y ( 6 5 , 2 ) ;c o u t < < " < 0 > = E x i t " ;
g o t o x y ( 3 , 3 ) ;
f o r ( i = 1 ; i < = 7 6 ; i + + )
c p r i n t f ( " " ) ;
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 57/80
t e x t b a c k g r o u n d ( B L A C K ) ;
t e x t c o l o r ( B L A C K + B L I N K ) ;
t e x t b a c k g r o u n d ( W H I T E ) ;g o t o x y ( 3 0 , 3 ) ;
c p r i n t f ( " O pe n N e w A c c o u n t " ) ;
t e x t c o l o r ( L I G H T G R A Y ) ;t e x t b a c k g r o u n d ( B L A C K ) ;
i n t d 1 , m 1 , y 1 ;
s t r u c t d a t e d ; / / F o r e x t r a c t i n g s y s t e m d a t eg e t d a t e ( & d ) ;
d 1 = d . d a _ d a y ;
m 1 = d . d a _ m o n ;
y 1 = d . d a _ y e a r ;i n t t _ a c c n o ;
t _ a c c n o = i n i . l a s t_ a c c n o ( ) ;
t _ a c c n o + + ;
/ / A p p e n d s a n d d e l e t e s a f a l s e r e c o r d t o c r e a t e p r i m a r y p o s i t i o n
i n d a t a f i l e si f ( t _ a c c n o = = 1 )
{
i n i . a d d _ t o _ f i le ( t _ a c c n o , " a b c " , " x y z " , 1 . 1 ) ;i n i . d e l e t e _ a c c o u n t ( t _ a c c n o ) ;
a d d _ t o _ f i l e ( t_ a c c n o , 1 , 1 , 1 9 9 7 , ' D ' , " I N I T I A L " , 1 . 1 , 1 . 1 ,
1 . 1 ) ;
d e l e t e _ a c c o u n t ( t _ a c c n o ) ;}
c h a r t _ n a m e [ 3 0 ] , t [ 1 0 ] , t _ a d d r e s s [ 3 0 ] ;
f l o a t t _ b a l = 0 . 0 , t _ b a l a n c e = 0 . 0 ;g o t o x y ( 5 , 6 ) ;
c o u t < < " D a t e : " < < d 1 < < ' / ' < < m 1 < < ' / ' < < y 1 ;
g o t o x y ( 5 , 8 ) ;c o u t < < " A c c o u n t N o # " < < t _ a c c n o ;
g o t o x y ( 5 , 1 0 ) ;
c o u t < < " N a m e : " ;
g o t o x y ( 5 , 1 1 ) ;c o u t < < " A d d r e s s : " ;
g o t o x y ( 5 , 1 2 ) ;
c o u t < < " N a m e o f v e r i f y i n g P e r s o n : " ;g o t o x y ( 5 , 1 4 ) ;
c o u t < < " I n i t i a l D e p o s i t : " ;
d o
{
c l e a r ( 1 5 , 1 0 ) ;
c l e a r ( 5 , 2 3 ) ;
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 58/80
g o t o x y ( 5 , 2 3 ) ;
c o u t < < " E n t e r N a m e o f t h e P e r s o n " ;
v a l i d = 1 ;g o t o x y ( 1 5 , 1 0 ) ;
g e t s ( t _ n a m e ) ;
s t r u p r ( t _ n a m e ) ;i f ( t _ n a m e [ 0 ] = = ' 0 ' )
r e t u r n ;
i f ( s t r l e n ( t _n a m e ) = = 0 | | s t r l e n ( t _ n a m e) > 2 5 ){
v a l i d = 0 ;
g o t o x y ( 5 , 2 3 ) ;
c p r i n t f ( " \ 7 N a m e s h o u l d n o t g r e a t e r t h a n 2 5 " ) ;g e t c h ( ) ;
}
} w h i l e ( ! v a l i d ) ;
d o
{c l e a r ( 2 5 , 1 5 ) ;
c l e a r ( 5 , 2 3 ) ;
g o t o x y ( 5 , 2 3 ) ;c o u t < < " E n t e r A d d r e s s o f t h e P e r s o n " ;
v a l i d = 1 ;
g o t o x y ( 1 5 , 1 1 ) ;
g e t s ( t _ a d d r e s s ) ;s t r u p r ( t _ a d d r e s s ) ;
i f ( t _ a d d r e s s [ 0 ] = = ' 0 ' )
r e t u r n ;i f ( s t r l e n ( t _ a d d r e s s ) = = 0 | | s t r l e n ( t _ a d d r e s s ) > 2 5 )
{
v a l i d = 0 ;g o t o x y ( 5 , 2 3 ) ;
c p r i n t f ( " \ 7 A d d r e s s s h o u l d n o t g r e a t e r t h a n 2 5 " ) ;
g e t c h ( ) ;
}} w h i l e ( ! v a l i d ) ;
d o{
c h a r v a r i [ 3 0 ] ;
c l e a r ( 1 3 , 1 2 ) ;c l e a r ( 5 , 2 3 ) ;
g o t o x y ( 5 , 2 3 ) ;
c o u t < < " E n t e r n a m e o f t h e v a r i f y i n g P e r s o n " ;
v a l i d = 1 ;
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 59/80
g o t o x y ( 3 1 , 1 2 ) ;
g e t s ( v a r i ) ;
s t r u p r ( v a r i ) ;i f ( v a r i [ 0 ] = = ' 0 ' )
r e t u r n ;
i f ( s t r l e n ( v a r i ) = = 0 | | s t r l e n ( v a r i ) > 2 5 ){
v a l i d = 0 ;
g o t o x y ( 5 , 2 3 ) ;c p r i n t f ( "S h o u l d n o t b l a n k o r g r e a t e r t h a n 2 5 " ) ;
g e t c h ( ) ;
}
} w h i l e ( ! v a l i d ) ;
d o
{
c l e a r ( 1 3 , 1 2 ) ;c l e a r ( 5 , 2 3 ) ;
g o t o x y ( 5 , 2 3 ) ;c o u t < < " E n t e r i n i t i a l a m o u n t t o b e d e p o s i t " ;
v a l i d = 1 ;
g o t o x y ( 2 3 , 1 4 ) ;g e t s ( t ) ;
t _ b a l = a t o f ( t ) ;
t _ b a l a n c e = t _ b a l ;
i f ( t [ 0 ] = = ' 0 ' ){
v a l i d = 0 ;
g o t o x y ( 5 , 2 3 ) ;c p r i n t f ( " \ 7 S h o u l d n o t l e s s t h a n 5 0 0 " ) ;
g e t c h ( ) ;
}} w h i l e ( ! v a l i d ) ;
c l e a r ( 5 , 2 3 ) ;
d o{
c l e a r ( 5 , 1 7 ) ;
v a l i d = 1 ;g o t o x y ( 5 , 1 7 ) ;
c o u t < < " D o y o u w a n t t o s a v e t h e r e c o r d < Y / N > : " ;
c h = g e t c h e ( ) ;i f ( c h = = ' 0 ' )
r e t u r n ;
c h = t o u p p e r ( c h ) ;
} w h i l e ( c h ! = ' N ' & & c h ! = ' Y ' ) ;
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 60/80
i f ( c h = = ' N ' )
r e t u r n ;f l o a t t _ a m o u n t , t _ i n t e r e s t ;
t _ a m o u n t = t _ b a l a n c e ;
t _ i n t e r e s t = 0 . 0 ;c h a r t _ t r a n , t _ t y p e [ 1 0 ] ;
t _ t r a n = ' D ' ;
s t r c p y ( t _ ty p e , " I N I T I A L " ) ;
/ / A p p e n d s t h e r e c o r d s c o n t e n t s i n t o b o t h I N I T I A L . d a t a n d
B A N K I N G . d a t d a t a f i l e s
i n i . a d d _ t o _ f i le ( t _ a c c n o , t _ n a m e , t _ a d d r e s s , t _ b a l a n c e ) ;a d d _ t o _ f i l e ( t_ a c c n o , d 1 , m 1 , y 1 , t _ t r a n , t _ t y p e , t _ i n t e r e s t ,
t _ a m o u n t , t _ b a l a n c e ) ;
}
/ * F u n c t i o n f o r r e t u r n i n g b a l a n c e a m o u n t o f a n a c c o u n t . T h i s
f u n c t i o n r e t u r n s t h e b a l a n c e a m o u n t o f a n y a c c o u n tt o k n o w t h e c u r r e n t b a l a n c e f r o m " I N I T I A L . d a t " d a t a f i l e . * /
f l o a t i n i t i a l : : g i v e _ b a l a n c e ( in t t _ a c c n o ){
f s t r e a m f i l e ;
f i l e . o p e n ( " IN I T I A L . d a t " , i o s : : i n ) ;
f i l e . s e e k g (0 , i o s : : b e g ) ;f l o a t t _ b a l a n c e ;
/ / G i v e s t h e l a s t b a l a n c e o f a n i n d i v i d u a l a c c o u n tw h i l e ( f i l e . r e a d ( ( c h a r * ) t h i s , s i z e o f ( i n i t i a l ) ) )
{
i f ( a c c n o = = t _ a c c n o ){
t _ b a l a n c e = b a l a n c e ;
b r e a k ;
}}
f i l e . c l o s e ( ) ;
r e t u r n t _ b a l a n c e ;}
/ * F u n c t i o n f o r r e t u r n i n g t h e r e c o r d n o . f o r u p d a t i n g b a l a n c eT h i s f u n c t i o n c h e c k t h e p o s i t i o n o f t h e a c c o u n t n u m b e r f o r u p d a t i n g
n e w b a l a n c e a m o u n t
i n t o e i t h e r " I N I T I A L . d a t " o r " B A N K I N G . d a t " d a t a f i l e s . * /
i n t i n i t i a l : : r e c o r d n o ( i n t t _ a c c n o )
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 61/80
{
f s t r e a m f i l e ;
f i l e . o p e n ( " IN I T I A L . d a t " , i o s : : i n ) ;f i l e . s e e k g (0 , i o s : : b e g ) ;
i n t c o u n t = 0 ;
/ / F i n d s t h e r e c o r d p o s i t i o n i n I N I T I A L . da t d a t a f i l e
w h i l e ( f i l e . r e a d ( ( c h a r * ) t h i s , s i z e o f ( i n i t i a l ) ) )
{c o u n t + + ;
i f ( t _ a c c n o = = a c c n o )
b r e a k ;
}f i l e . c l o s e ( ) ;
r e t u r n c o u n t ;
}
/ * F u n c t i o n f o r u p d a t i n g t h e b a l a n c e f o r t h e g i v e n a c c o u n t n o .T h i s f u n c t i o n i s u s e d t o u p d a t e t h e b a l a n c e a f t e r m a k i n g a n y
t r a n s a c t io n i n " I N I T I A L . d a t " d a t a f i l e .W h i l e u p d a t i n g b a l a n c e i n " I N I T I A L . d a t " d a t a f i l e , a l l t h e f i e l d s
w i l l t r a n s f e r i n t o a t t h e s p e c i f i e d
p o s i t i o n i n t h e f i l e , b e c a u s e w i t h r a n d o m f i l e h a n d l i n g w h e n w eu p d a t e a n y r e c o r d t h e s i z e o f t h e r e c o r d b e c o m e s
o v e r w r i t e a t t h e s a m e p l a c e . S o , a l l t h e f i e l d s i n c l u d i n g b a l a n c e
a m o u n t w i l l w r i t e i n t o t h e s a m e p o s i t i o n i n
" I N I T I A L . d a t" d a t a f i l e . H e r e t h i s f u n c t i o n u s e s a f u n c t i o n s e e k p ( ) ,w h i c h s e a r c h e s t h e l o c a t i o n i n t h e d a t a f i l e
w h e r e t h e r e c o r d w i l l b e w r i t e . * /
v o i d i n i t i a l : : u p d a t e _ b a la n c e ( i n t t _ a c c n o , c h a r t _ n a m e [ 3 0 ] , c h a r
t _ a d d r e s s [ 3 0] , f l o a t t _ b a l a n c e )
{i n t r e c n o ;
r e c n o = r e c o r d n o ( t _ a c c n o ) ;
f s t r e a m f i l e ;
f i l e . o p e n ( " IN I T I A L . d a t " , i o s : : o u t | i o s : : a t e ) ;s t r c p y ( n a m e , t _ n a m e ) ;
s t r c p y ( a d d r es s , t _ a d d r e s s ) ;
b a l a n c e = t _ b a l a n c e ;i n t l o c a t i o n ;
l o c a t i o n = ( r e c n o - 1 ) * s i z e o f ( i n i t i a l ) ; / / F i n d t h e l o c a t i o n i n
f i l ef i l e . s e e k p ( l o c a t i o n ) ; / / S e a rc h e s t he i n s e r t i o n p o s i t i o n in d a t a
f i l e
/ / U p d a t e s t h e b a l a n c e a m o u n t i n I N I T I A L . d a t d a t a f i l e
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 62/80
f i l e . w r i t e ( ( c h a r * ) t h i s , s i z e o f ( i n i t i a l ) ) ;
f i l e . c l o s e ( ) ;
}
/ * F u n c t i o n t o r e t u r n n o . d a y s b e t w e e n t w o d a t e s .
T h e f u n c t i o n c a l c u l a t e s t o t a l n u m b e r o f d a y s b e t w e e n t w o d a t e . A n dt h e f u n c t i o n p a s s e s p a r a m e t e r s a s r e l a t e d t o d a t e ( d a y , m o n t h , y e a r ) .
* /
i n t a c c o u n t : : n o _ o f _ da y s ( i n t d 1 , i n t m 1 , i n t y 1 , i n t d 2 , i n t m 2 , i n t y 2 )
{
s t a t i c i n t m o n t h [ ] = { 3 1 , 2 8 , 3 1 , 3 0 , 3 1 , 3 0 , 3 1 , 3 0 , 3 1 , 3 0 , 3 1 ,
3 0 } ;i n t d a y s = 0 ;
w h i l e ( d 1 ! = d 2 | | m 1 ! = m 2 | | y 1 ! = y 2 )
{
d a y s + + ;d 1 + + ;
i f ( d 1 > m o n t h [ m 1 - 1 ] ){
d 1 = 1 ;
m 1 + + ;}
i f ( m 1 > m 2 )
{
m 1 = 1 ;y 1 + + ;
}
}r e t u r n d a y s ;
}
/ * F u n c t i o n f o r c a l c u l a t e s i n t e r e s t
T h i s f u n c t i o n c a l c u l a t e t h e i n t e r e s t o f a n y a c c o u n t a c c o u d i n g t o t h e
a c c o u n t n o . a n d b a l a n c e f r o m " B A N K I N G . d a t a " d a t a f i l e
B e f o r e c a l c u l a t e t h e i n t e r e s t , t h e f u n c a t i o n a l s o f i n d s t o t a l n u m b e r o f d a y s a n d t h e n f i n d t h e i n t e r e s t . * /
f l o a t a c c o u n t : : c a l c u l a t e _ i n t e re s t ( i n t t _ a c c n o , f l o a t t _ b a l a n c e ){
f s t r e a m f i l e ;
f i l e . o p e n ( " B AN K I N G . d a t " , i o s : : i n ) ;f i l e . s e e k g (0 , i o s : : b e g ) ;
i n t d 1 , m 1 , y 1 , d a y s ;
w h i l e ( f i l e . r e ad ( ( c h a r * ) t h i s , s i z e o f ( a c c o u n t ) ) )
{
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 63/80
i f ( a c c n o = = t _ a c c n o )
{
d 1 = d d ;m 1 = m m ;
y 1 = y y ;
b r e a k ;}
}
i n t d 2 , m 2 , y 2 ;s t r u c t d a t e d ;
g e t d a t e ( & d ) ;
d 2 = d . d a _ d a y ;
m 2 = d . d a _ m o n ;y 2 = d . d a _ y e a r ;
f l o a t t _ i n t e r e s t = 0 . 0 ;
i f ( ( y 2 < y 1 ) | | ( y 2 = = y 1 & & m 2 < m 1 ) | | ( y 2 = = y 1 & & m 2 = =
m 1 ) & & ( d 2 < d 1 ) )r e t u r n t _ i n t e r e s t ;
d a y s = n o _ o f _ d a y s ( d 1 , m 1 , y 1 , d 2 , m 2 , y 2 ) ;i n t m o n t h s = 0 ;
i f ( d a y s > 3 0 )
{m o n t h s = d a y s / 3 0 ;
t _ i n t e r e s t = ( ( t _ b a l a n c e * 2 ) / 1 0 0 * m o n t h s ) ;
}
f i l e . c l o s e ( ) ;r e t u r n t _ i n t e r e s t ;
}
/ * F u n c t i o n f o r m a k i n g d a i l y t r a n s a c t i o n ( D e p o s i t ' D ' / W i t h d r a w ' W ' .
T h i s i s t h e f u n c t i o n u s e d t o m a k e d a i l y t r a n s a c t i o n e i t h e r f o r
D e p o s i t ( D ) o r f o r W i t h d r a w ( W ) . W h e n t h e s c r e e n a p p e a r st h e u s e r h a s t o p r e s s t h e a c c o u n t n o . a n d e i t h e r f o r d e p o s i t o r
w i t h d r a w a n d t h e n e i t h e r C a s h o r C h e q u e . W h i l e s c r e e n i n g
t h e s a m e s c r e e n a l s o s h o w s t h e p r e v i o u s b a l a n c e f o r d e p o s i t o r
w i t h d r a w . A f t e r t h e f i n a l e n t r y , i t s p e a k s " S a v e T r a n s a c t i o n < y / n > ? "a n d i f y e s .
t h e n t h e t r a n s a c t i o n d a t a s a v e d i n " B A N K I N G . d a t " d a t a f i l e a n d t h e
c u r r e n t b a l a n c e u p d a t e d i n t h e " I N I T I A L . d a t" d a t a f i l e . * /
v o i d a c c o u n t : : t ra n s a c t i o n ( v o i d )
{c l r s c r ( ) ;
c h a r t _ a c c [ 1 0 ] ;
i n t t , t _ a c c n o , v a l i d ;
g o t o x y ( 7 1 , 1 ) ;
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 64/80
c o u t < < " < 0 > = E x i t " ;
g o t o x y ( 5 , 5 ) ;
c o u t < < " E n t e r t h e a c c o u n t n o . " ;g e t s ( t _ a c c ) ;
t = a t o i ( t _ a c c ) ;
t _ a c c n o = t ;i f ( t _ a c c n o = = 0 )
r e t u r n ;
c l r s c r ( ) ;i n i t i a l i n i ;
i f ( ! i n i . f o u nd _ a c c o u n t ( t _ a c c n o ) )
{
g o t o x y ( 5 , 5 ) ;c o u t < < " \ 7 A c c o u n t n o t f o u n d " ;
g e t c h ( ) ;
r e t u r n ;
}g o t o x y ( 7 1 , 1 ) ;
c o u t < < " < 0 > = E x i t " ;g o t o x y ( 3 , 3 ) ;
f o r ( i n t i = 1 ; i < = 7 6 ; i + + )
c p r i n t f ( " " ) ;t e x t b a c k g r o u n d ( B L A C K ) ;
t e x t c o l o r ( B L A C K + B L I N K ) ;
t e x t b a c k g r o u n d ( W H I T E ) ;
g o t o x y ( 2 9 , 3 ) ;c p r i n t f ( " T r a n s a c t i o n i n A c c o u n t " ) ;
t e x t c o l o r ( L I G H T G R A Y ) ;
t e x t b a c k g r o u n d ( B L A C K ) ;i n t d 1 , m 1 , y 1 ;
s t r u c t d a t e d ;
g e t d a t e ( & d ) ;d 1 = d . d a _ d a y ;
m 1 = d . d a _ m o n ;
y 1 = d . d a _ y e a r ;
g o t o x y ( 5 , 6 ) ;c o u t < < " D a t e : " < < d 1 < < " / " < < m 1 < < " / " < < y 1 ;
g o t o x y ( 5 , 8 ) ;
c o u t < < " A c c n o u n t n o . " < < t _ a c c n o ;c h a r t _ n a m e [ 3 0 ] ;
c h a r t _ a d d r e s s [ 3 0 ] ;
f l o a t t _ b a l a n c e ;s t r c p y ( t _ n a me , i n i . r e t u r n _ n am e ( t _ a c c n o ) ) ;
s t r c p y ( t _ a d dr e s s , i n i . r e t u r n_ a d d r e s s ( t _ a c cn o ) ) ;
t _ b a l a n c e = i n i . g i v e _ b a l a n c e ( t _ a c c n o ) ;
g o t o x y ( 2 7 , 1 1 ) ;
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 65/80
c o u t < < " N a m e : " < < t _ n a m e ;
g o t o x y ( 2 7 , 1 2 ) ;
c o u t < < " A d d r e s s : " < < t _ a d d r e s s ;
g o t o x y ( 5 , 1 5 ) ;
c o u t < < " L a s t b a l a n c e R s . " < < s e t w ( 1 5 )< < s e t p r e c i s io n ( 2 )
< < s e t i o s f l a g s ( i o s : : l e f t )
< < s e t i o s f l a g s ( i o s : : s h o w p o i n t )< < s e t i o s f l a g s ( i o s : : f i x e d )
< < t _ b a l a n c e ;
c h a r t _ t r a n , t _ t y p e [ 1 0 ] , t m [ 1 0 ] ;f l o a t t _ a m o u n t , t _ a m t ;
d o
{ c l e a r ( 5 , 1 0 ) ;
v a l i d = 1 ;g o t o x y ( 5 , 1 0 ) ;
c o u t < < " D e p o s i t o r W i t h d r a w ( D / W ) : " ;
t _ t r a n = g e t c h ( ) ;i f ( t _ t r a n = = ' 0 ' )
r e t u r n ;
t _ t r a n = t o u p p e r ( t _ t r a n ) ;
} w h i l e ( t _ t r a n ! = ' D ' & & t _ t r a n ! = ' W ' ) ;
d o
{c l e a r ( 5 , 1 9 ) ;
c l e a r ( 5 , 2 3 ) ;
g o t o x y ( 5 , 2 3 ) ;c o u t < < " E n t e r T r a n s a c t i o n b y C a s h o r C h e q u e " ;
v a l i d = 1 ;
g o t o x y ( 5 , 1 9 ) ;
c o u t < < " C a s h / C h e q u e : " ;g e t s ( t _ t y p e ) ;
s t r u p r ( t _ t y p e ) ;
i f ( t _ t y p e [ 0 ] = = ' 0 ' )r e t u r n ;
i f ( s t r c m p ( t _ t y p e , " C A S H " ) & & s t r c m p ( t _ t y p e ,
" C H E Q U E " ) ){
v a l i d = 0 ;
g o t o x y ( 5 , 2 3 ) ;
c p r i n t f ( " \ 7 E n t e r c o r r e c t l y " ) ;
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 66/80
g e t c h ( ) ;
}
} w h i l e ( ! v a l i d ) ;
d o
{ c l e a r ( 5 , 2 1 ) ;
c l e a r ( 5 , 2 3 ) ;
g o t o x y ( 5 , 2 3 ) ;c o u t < < " E n t e r A m o u n t f o r T r a n s a c t io n " ;
v a l i d = 1 ;
g o t o x y ( 5 , 2 1 ) ;
c o u t < < " A m o u n t R s . " ;g e t s ( t m ) ;
t _ a m t = a t o f ( t m ) ;
t _ a m o u n t = t _ a m t ;
i f ( t m [ 0 ] = = ' 0 ' )r e t u r n ;
i f ( ( t _ t r a n = = ' W ' & & t _ a m o u n t > t _ b a l a n c e ) | | ( t _ a m o u n t< 1 ) )
{
v a l i d = 0 ;g o t o x y ( 5 , 2 3 ) ;
c p r i n t f ( " \ 7 I n v a l i d D a t a e n t e r e d " ) ;
g e t c h ( ) ;
}} w h i l e ( ! v a l i d ) ;
c h a r c h ;c l e a r ( 5 , 2 3 ) ;
d o
{c l e a r ( 2 0 , 2 3 ) ;
v a l i d = 1 ;
g o t o x y ( 4 0 , 2 0 ) ;
c o u t < < " S a v e T r a n s a c t i o n < Y / N > : " ;c h = g e t c h e ( ) ;
i f ( c h = = ' 0 ' )
r e t u r n ;c h = t o u p p e r ( c h ) ;
} w h i l e ( c h ! = ' N ' & & c h ! = ' Y ' ) ;
i f ( c h = = ' N ' )r e t u r n ;
f l o a t t _ i n t e r e s t ;
t _ i n t e r e s t = c a l c u l a t e _ i n te r e s t ( t _ a c c n o, t _ b a l a n c e ) ;
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 67/80
i f ( t _ t r a n = = ' D ' )
t _ b a l a n c e = t _ b a l a n c e + t _ a m o u n t + t _ i n t e r e s t ;e l s e
t _ b a l a n c e = ( t _ b a l a n c e - t _ a m o u n t ) + t _ i n t e r e s t ;
/ / M o d i f i e d r e c o r d s a r e u p d a t e d i n d a t a b a s e s .
i n i . u p d a t e _ b a l a n c e ( t _ a c c n o , t _ n a m e , t _ a d d r e s s , t _ b a l a n c e ) ;
a d d _ t o _ f i l e ( t_ a c c n o , d 1 , m 1 , y 1 , t _ t r a n , t _ t y p e , t _ i n t e r e s t ,t _ a m o u n t , t _ b a l a n c e ) ;
}
/ * F u n c t i o n f o r c l o s i n g a n y a c c o u n t a f t e r i n p u t i n g a c c o u n t n u m b e r .W h e n a n y a c c o u n t h o l d e r i n t e r e s t ed t o c l o s e h i s / h e r a c c o u n t t h e n
t h i s f u n c t i o n h e l p s t o c l o s e
t h e a c c o u n t c o m p l e t e l y , m e a n s a l l t h e t r a n s a c t io n s f r o m t h e
" B A N K I N G . d a t " a n d " I N I T I A L . d a t " f i l e d e l e t e st h e p a r t i c u l a r r e c o r d i n f o r m a t io n . T h e f u n c t i o n a l s o u s e s n o . o f o t h e r
f u n c t i o n s w h i c h f u l l f i l l t h e t h e t o t a lc l o s e _ a c c o u n t p r o c e d u r e a s w e l l . * /
v o i d a c c o u n t : : c lo s e _ a c c o u n t ( v o i d ){
c l r s c r ( ) ;
c h a r t _ a c c [ 1 0 ] ;
i n t t , t _ a c c n o ;g o t o x y ( 7 1 , 1 ) ;
c o u t < < " < 0 > = E x i t " ;
g o t o x y ( 5 , 5 ) ;c o u t < < " E n t e r t h e a c c o u n t n o . " ;
g e t s ( t _ a c c ) ;
t = a t o i ( t _ a c c ) ;t _ a c c n o = t ;
i f ( t _ a c c n o = = 0 )
r e t u r n ;
c l r s c r ( ) ;i n i t i a l i n i ;
i f ( ! i n i . f o u nd _ a c c o u n t ( t _ a c c n o ) )
{g o t o x y ( 5 , 5 ) ;
c o u t < < " \ 7 A c c o u n t n o t f o u n d " ;
g e t c h ( ) ;r e t u r n ;
}
g o t o x y ( 7 1 , 1 ) ;
c o u t < < " < 0 > = E x i t " ;
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 68/80
g o t o x y ( 3 , 3 ) ;
t e x t b a c k g r o u n d ( W H I T E ) ;
f o r ( i n t i = 1 ; i < = 7 6 ; i + + )c p r i n t f ( " " ) ;
t e x t b a c k g r o u n d ( B L A C K ) ;
t e x t c o l o r ( B L A C K + B L I N K ) ;t e x t b a c k g r o u n d ( W H I T E ) ;
g o t o x y ( 3 0 , 3 ) ;
c p r i n t f ( " Cl o s e a c c o u n t s c r e e n " ) ;t e x t c o l o r ( L I G H T G R A Y ) ;
t e x t b a c k g r o u n d ( B L A C K ) ;
i n t d 1 , m 1 , y 1 ;
s t r u c t d a t e d ;g e t d a t e ( & d ) ;
d 1 = d . d a _ d a y ;
m 1 = d . d a _ m o n ;
y 1 = d . d a _ y e a r ;g o t o x y ( 5 , 6 ) ;
c o u t < < " D a t e : " < < d 1 < < " / " < < m 1 < < " / " < < y 1 ;c h a r c h ;
i n i . d i s p l a y ( t _ a cc n o ) ;
d o{
c l e a r ( 5 , 1 5 ) ;
g o t o x y ( 5 , 1 5 ) ;
c o u t < < " C l o s e t h i s a c c o u n t < y / n ? ? " ;c h = g e t c h e ( ) ;
i f ( c h = = ' 0 ' )
r e t u r n ;c h = t o u p p e r ( c h ) ;
} w h i l e ( c h ! = ' N ' & & c h ! = ' Y ' ) ;
i f ( c h = = ' N ' )r e t u r n ;
/ / F u n c t i o n c a l l s t o d e l e t e t h e e x i s t i n g a c c o u n t n o .
i n i . d e l e t e _ a c c o u n t ( t _ a c c n o ) ;d e l e t e _ a c c o u n t ( t _ a c c n o ) ;
g o t o x y ( 5 , 2 0 ) ;
c o u t < < " \ 7 A c c o u n t D e l e t e d " ;g o t o x y ( 5 , 2 3 ) ;
c o u t < < " P r e s s a n y k e y t o c o n t i n u e . . . " ;
g e t c h ( ) ;}
/ / M a i n p r o g r a m l o g i c w h i c h c o n t r o l t h e c l a s s m e m b e r s a n d m e m b e r
f u n c t i o n s .
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 69/80
v o i d m a i n ( v o i d )
{
m a i n _ m e n u m _ m e n u ;i n t g d r i v e r = D E T E C T , g m o d e , e r r o r c o d e ;
i n i t g r a p h ( &g d r i v e r , & g m o d e , " " ) ;
m _ m e n u . h e l p ( ) ;
c l o s e g r a p h ( ) ;
m _ m e n u . c o n t r o l _ m e n u ( ) ;}
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 78/80
ADVANTAGES
This project is made in C language and it is computerized so it has some
advantages. The advantages of this project are as following:-
1. Save time
2. Save money
3. Less paper work
4. Save manpower
5. Make work easy
6. Accuracy
7. Large memory
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 79/80
FUTURE SCOPE OF THE PROJECT
This project is aimed to improve organization effectiveness. It has a far-reaching impacton the entire organization. The implementation of the project will affect more the established
method and procedures .
This system can enhance the productivity by:
optimizing the output of the system.
helping in routine work functions.
Increase accuracy.
Reducing normal errors.
Effective management of time and resources.
7/29/2019 Banking C Project.doc
http://slidepdf.com/reader/full/banking-c-projectdoc 80/80
REFERENCE
I HAVE REFERRED SERVED REFERENCES TO CREATE
THIS ON THE JOB-TRAINING PROJECT REPORT.
THESE REFERENCES ARE:
* Let us ‘C’ (by: Yashwant Kanetkar)
∗Project in ‘C’ (by: Yashwant Kanetkar)
∗ SOME EXTRA ASSIGNMENT DELIVERED IN CLASS.