tag:blogger.com,1999:blog-62979532999710515132024-03-09T04:15:33.739+05:30Source code of Programs, Projects, Games, Articles,Test your c++ skills, in Turbo C++Here you find plenty of c++ programs written in turbo c++ compiler absolutely free. you can also find your solutions. our team will do our best to satisfy youUpinder Singh Dhamihttp://www.blogger.com/profile/10526677796017634649noreply@blogger.comBlogger138125tag:blogger.com,1999:blog-6297953299971051513.post-69394621884939885392010-02-03T20:51:00.003+05:302010-02-03T21:43:15.454+05:30write a program to check whether the given number was of the form 3^n. ( i.e. 3 to the power n).//find wheather a number is in the form of 3pow(n)<br />
#include<iostream.h><br />
#include<conio.h><br />
#include<process.h><br />
#include<math.h><br />
void recur(int);<br />
int i=1,n;<br />
void main()<br />
{ clrscr();<br />
// extern int n;<br />
cout<<"enter the number: ";<br />
cin>>n;<br />
recur(3);<br />
<br />
}<br />
void recur(int x)<br />
{ if(x==n)<br />
{ cout<<"number is multiple";<br />
getch();<br />
exit(0);<br />
}<br />
if(x>n)<br />
{ cout<<"number is not multiple";<br />
getch();<br />
exit(0);<br />
}<br />
else<br />
{ recur(pow(3,++i));<br />
}<br />
}Upinder Singh Dhamihttp://www.blogger.com/profile/10526677796017634649noreply@blogger.com2tag:blogger.com,1999:blog-6297953299971051513.post-85659264720418382382010-02-03T20:50:00.002+05:302010-02-03T20:50:59.933+05:30There are two sorted arrays, a1 and a2 of size n1 and size n2 respectively. array a1 is full, array a2 has exactly n1(size of array a1) empty space. Example, a1[]=1234, a2[]=56789_ _ _ _ Write a function to merge these two arrays to form a sorted array without any extra memory use.#include<iostream.h><br />
#include<conio.h><br />
void main()<br />
{ clrscr();<br />
int n,m,i,j,temp;<br />
cout<<"enter the size of first array: ";<br />
cin>>n;<br />
cout<<"enter the size of second array: ";<br />
cin>>m;<br />
int *p=new int[n];<br />
int *q=new int[n+m];<br />
cout<<"enter the sorted elements of first array: ";<br />
for(i=0;i<n;i++)<br />
cin>>p[i];<br />
cout<<"enter the sorted elements of second array: ";<br />
for(i=0;i<m;i++)<br />
cin>>q[i];<br />
i=0;j=0;<br />
while(1)<br />
{ while(1)<br />
{ if(p[i]<q[j])<br />
{ temp=m;<br />
for(temp=m;temp>=j;temp--)<br />
<br />
q[temp]=q[temp-1];<br />
<br />
m++;<br />
break;<br />
}<br />
j++;<br />
if(j==m)<br />
{ temp=n;<br />
for(i=0;i<temp;i++)<br />
{ q[m]=p[i];<br />
m++;<br />
}<br />
cout<<"after sorting elements are: ";<br />
for(i=0;i<m;i++)<br />
cout<<q[i]<<",";<br />
getch();<br />
return;<br />
}<br />
}<br />
i++;<br />
n--;<br />
if(n==-1)<br />
{ for(i=0;i<m+n;i++)<br />
cout<<q[i];<br />
break;<br />
}<br />
}<br />
getch();Upinder Singh Dhamihttp://www.blogger.com/profile/10526677796017634649noreply@blogger.com0tag:blogger.com,1999:blog-6297953299971051513.post-69293391275450400072010-02-03T20:49:00.000+05:302010-02-03T20:49:03.044+05:30suppose u r given a 4*3 rectangle like (take these values from user) Now u have to calculate the no. of squares in this rectangle like: No. of squares of dimension 1 is 12 No. of squares of dimension 2 is 6 No. of squares of dimension 3 is 2 No. of squares of dimension 4 is 0 Total no. of squares are 20.#include<iostream.h><br />
#include<conio.h><br />
void main()<br />
{ clrscr();<br />
int n,m,temp;<br />
cout<<"enter the length and breadth of the rectangle: ";<br />
cin>>n>>m;<br />
int k=n<m?n:m;<br />
for(int i=1;i<=k;i++)<br />
{ cout<<"number of cubes when dimension is"<<i<<" :";<br />
temp=(n-i+1)*(m-i+1);<br />
if(temp<0)<br />
cout<<"0";<br />
else if(temp==0)<br />
{ temp=(n>m?n:m)-k+1;<br />
cout<<temp;<br />
}<br />
else<br />
{ cout<<temp;<br />
}<br />
cout<<endl;<br />
}<br />
getch();<br />
}Upinder Singh Dhamihttp://www.blogger.com/profile/10526677796017634649noreply@blogger.com0tag:blogger.com,1999:blog-6297953299971051513.post-35113140106397692222009-11-02T21:27:00.003+05:302010-01-23T01:35:54.914+05:30<div style="text-align: center;"><span style="color: blue; font-size: x-large;">PROGRAMS</span><br />
</div><br />
<br />
<b><span style="font-size: large;">Basic Programs</span></b><br />
<ul><li><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/08/include-include-void-main-absum-value.html">Sum of two numbers on c++</a> </span></li>
<li><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/08/fundamentals-of-signed-and-unsigned.html">Program to demonstrate signed and unsigned number in c++</a></span></li>
<li><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/08/print-car.html">Program to print a car simply using text characters in c++</a></span></li>
<li><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/08/print-heart.html">Program to print heart simply using text characters in c++</a> </span></li>
<li><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/08/importance-of-getch-clrscr.html">Program to show importance of getch and clrscr in c++</a> </span></li>
<li><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/08/importance-of-getchar.html">Program which show importance of getchar in c++</a></span></li>
<li><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/08/importance-of-getche.html">Program to show importance of getche in c++</a> </span></li>
<li><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/08/input-output-two-dimensional-array.html">Program which demonstrate input output of 2 dimensional array in c++</a> </span></li>
<li><span style="font-size: small;"><a href="http://www.blogger.com/post-edit.g?blogID=6297953299971051513&postID=3511314010639769222">Program which demonstrate recursion in c++</a></span></li>
<li><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/08/range-of-integer-value.html">Program which show range of integers and other data types in c++</a> </span></li>
<li><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/08/evalute-xpowx22powx44-powxnn.html">Program which evalute the expression evalute x+pow(x,2)/2!+pow(x,4)/4!+_______ pow(x,n)/n! in c++</a> </span></li>
<li><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/08/evalute-zzz2-zzz3-zzzz4.html">Program which evalute the expression evalute z+z*z/2 +z*z*z/3 +z*z*z*z/4 in c++</a> </span></li>
<li><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/08/calulate-gain-in-amount-by-adding-11.html">calulate-gain-in-amount-by-adding-11</a> </span></li>
</ul><ul><li><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/08/average-of-n-numbers.html">Program which find the average of n numbers in c++</a></span></li>
</ul><br />
<br />
<br />
<br />
<b><span style="font-size: large;">Programs of Patterns </span></b><br />
<ul><li><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/08/print-address.html">Program to print address simply using text characters in c++</a> </span></li>
<li><span style="font-size: small;"> <a href="http://advance-programing.blogspot.com/2009/08/print-hut-using-loop.html">Program to print Hut using loop in c++</a> </span></li>
<li><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/08/hut-with-security-code.html">Program to print hut using loop with security code</a> </span></li>
<li><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/08/pattern1.html">Program to print Pattern of pyramid in c++</a> </span></li>
<li><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/08/pattern2.html">Program to print triangular pattern in c++</a> </span></li>
<li><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/08/program-to-print-double-pyramid.html">Program to print double pyramid in c++</a> </span></li>
<li><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/08/print-diamond.html">Program to print diamond in c++</a> </span></li>
</ul><br />
<br />
<br />
<span style="font-size: small;"><b><span style="font-size: large;"> Programs of Recursion</span></b></span><br />
<ul><li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/08/print-fabonacci-series-using-recursion.html">Program to print fabonacci series using recursion in c++</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/08/factorial-using-recursion.html">Program to find factorial using recursion in c++</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/08/sum-of-n-numbers-using-recursion.html">Program to find the sum of n numbers using recursion in c++</a> </span></span></span></li>
</ul><br />
<br />
<span style="font-size: small;"><b><span style="font-size: large;">Programs of Function </span></b></span><br />
<ul><li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/08/basic-of-function.html">Program to show basics of functions using c++</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/08/find-hcf-using-function.html">Program to find HCF using functions in c++</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/08/write-program-which-takes-number-and.html">Program which takes a number and return the sum of its digits using function</a> </span></span></span></li>
</ul><br />
<br />
<span style="font-size: small;"><b><span style="font-size: large;">Programs of String & Pointer <br />
</span></b></span><br />
<ul><li><span style="font-size: small;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-convert-string-into-lower.html">Program to convert a string into lower case without using inbuilt function in c++</a> </span></span></li>
<li><span style="font-size: small;"><span style="font-size: small;"> <a href="http://advance-programing.blogspot.com/2009/09/program-to-convert-string-in-uppercase.html">Program to convert a string in uppercase without using inbuilt function </a> </span></span></li>
<li><span style="font-size: small;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-show-periority-of-increment.html">Program to demonstrate periority of increment and decrement operators in c++</a> </span></span></li>
<li><span style="font-size: small;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-display-single-character-the.html">Program to show single character at the cursor position in c++</a> </span></span></li>
<li><span style="font-size: small;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-print-random-number.html">Program to print a random number in c++</a> </span></span></li>
<li><span style="font-size: small;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-remove-first-and-last.html">Program to remove first and last occurance of a character in c++</a> </span></span></li>
<li><span style="font-size: small;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-of-selection-sort.html">Program of selection sort in c++</a> </span></span></li>
<li><span style="font-size: small;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-reverse-string-without-using.html">Program to reverse the string without using inbuilt function</a> </span></span></li>
<li><span style="font-size: small;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-which-show-basics-of-pointer.html">Program which show the basics of pointer</a> </span></span></li>
<li><span style="font-size: small;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-count-characters-words-and.html">Program to count characters, words & lines in the string in c++</a> </span></span></li>
<li><span style="font-size: small;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-count-vovelsdigitsspacescons.html">Program to count vovels,digits,spaces,consonent and other characters in a string in c++</a> </span></span></li>
<li><span style="font-size: small;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-sort-string.html">Program to sort a string in c++</a> </span></span></li>
<li><span style="font-size: small;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-find-number-of-substrings-in.html">Program to find number of substrings in a string in c++</a> </span></span></li>
<li><span style="font-size: small;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-of-password-where-you-write.html">Program of password, where you write your password and it print in the form of stars </a> </span></span></li>
<li><span style="font-size: small;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-of-dynamic-merge.html">Program of dynamic merge in c++</a> </span></span></li>
<li><span style="font-size: small;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-of-dynamic-sort.html">Program of dynamic sort in c++</a> </span></span></li>
<li><span style="font-size: small;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-toogle-string.html">Program to toggle a string in c++</a> </span></span></li>
<li><span style="font-size: small;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-which-convert-float-value-to.html">Program which convert float value to string in c++</a> </span></span></li>
<li><span style="font-size: small;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-show-use-of-gotoxy.html">Program which demonstrate use of gotoxy</a> </span></span></li>
<li><span style="font-size: small;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-of-merge-sort.html">Program of merge sort in c++</a> </span></span></li>
<li><span style="font-size: small;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/calculate-occurance-of-word-in-string.html">Program to calculate occurance of word in the string in c++</a> </span></span></li>
<li><span style="font-size: small;"><span style="font-size: small;"> <a href="http://advance-programing.blogspot.com/2009/09/program-to-find-factorial-of-large.html">Program to find the factorial of large number in c++</a> </span></span></li>
<li><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2010/01/string-of-charater-is-givenfind-highest.html">A string of charater is given.Find the highest occurance of a character and display that character. eg.: INPUT: AEGBCNAVNEETGUPTAEDAGPE, OUTPUT: E or I,J(if equal occurance)</a> </span></li>
<li><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/two-sentences-are-given-and-we-were.html">Two sentences are given and we were required to print the common word in the two sentences. Words were delimited by space, full stop, ? , ! and , . The trick in the question was that common word should be printed only once so if ur first sentence contains two word "how" and second contains "how" then in output how should be printed only once for this u can replace each matched word in second sentence by spaces </a> </span></li>
</ul><br />
<br />
<span style="font-size: small;"><b><span style="font-size: large;">Programs of Array </span></b></span><br />
<ul><li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-find-transpose-of-matrix.html">Program to find the transpose of matrix in c++</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-find-largest-number-in-each.html">Program to find largest number in each row of the matrix in c++</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-find-sum-of-rows-of-matrix.html">Program to find the sum of rows of matrix in c++</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-find-sum-of-diagonal.html">Program to find the sum of diagonal elements of matrix in c++</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-sort-array-using-function.html">Program to sort the array using function in c++</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-search-number-present-in.html">Program to search a number present in number of times in the array and also find its location in c++</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-find-product-of-matrix.html">Program to find the product of matrix using c++</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-insert-element-in-array.html">Program to simply insert elements in the array in c++</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-for-binary-search-of-elements.html">Program of binary search of elements which are already sorted</a> </span></span></span></li>
<li><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/there-is-matrix-n-x-n-its-elements.html">there is a matrix N x N .Its elements consist of either value =1 or value=0. If there is a any zero in the row, then the output matrix should have all zeroes in that row. If there is a single zero in any column then that column should have all zeroes n the output matrix. write the function to perform these operations</a> </span></li>
</ul><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"> </span></span><b><span style="font-size: large;"> </span></b><b><span style="font-size: large;"> </span></b></span><br />
<span style="font-size: small;"><br />
</span><br />
<span style="font-size: small;"><b><span style="font-size: large;">Programs of LinkList</span></b></span><br />
<ul><li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-show-basics-of-linklist.html">Program to show basics of link list in c++</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-count-number-of-nodes-in.html">Program to count number of nodes in c++</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-count-odd-values-of-node-in.html">Program to count odd value nodes in c++</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-search-node-by-value.html">Program to search a node in c++</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-search-node-by-value-and_7410.html">Program to search a node by value and replace it with next node</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-search-node-by-value-and_01.html">Program to search a node and remove it in c++</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-which-domonstrate-use-of-tree.html">Program which demonstrate use of tree</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-remove-alternate-nodesin.html">Program to remove alternative nodes in linklist in c++</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-reversea-link-list.html">Program to reverse linklist in c++</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-enter-name-and-email-of.html">Program to enter name and email of student using linklist</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-show-inserting-and-deleting.html">Program to show insert and deleting in queue in c++</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-remove-duplicate-node-from.html">Program to remove duplicate node in c++</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-insert-element-in-queue.html">Program to insert element in queue in c++</a> </span></span></span></li>
<li><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-convert-binary-number-into.html">Program to convert binary number into decimal number in c++</a></span><br />
</li>
</ul><br />
<br />
<b><span style="font-size: large;">Intermediate Programs </span></b><br />
<span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"></span></span></span><br />
<ul><li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-calculate-roots-of-fourth.html">Programs to find the roots of fourth order algebric equation in c++</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-solve-three-variable-linear.html">Program to solve three variable algebric equation</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/simple-program-of-railway-reservation.html">Program of simple railway reservation</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"> </span></span><a href="http://advance-programing.blogspot.com/2009/09/program-to-replace-substring-with.html">Program to replace a substring with another substring with same or different length in c++</a> </span></li>
<li><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-reverse-each-word-of-string.html">Program to reverse each word of string in c++</a> </span></li>
<li><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-save-output-as-bitmap-image.html">Program to save the graphical output of c++</a> </span></li>
<li><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-of-sparse-matrix.html">Program of sparse matrix in c++</a> </span></li>
</ul><span style="font-size: small;"></span><br />
<span style="font-size: small;"><br />
</span><br />
<span style="font-size: small;"><br />
</span><br />
<span style="font-size: small;"><br />
</span><br />
<span style="font-size: small;"><b><span style="font-size: large;">Programs of OOPS</span></b></span><br />
<ul><li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-add-sub-mul-and-divide-two.html">Program to add, subtract,multiply 2 complex numbers using classes in c++</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-find-area-and-circumference.html">Program to find area and circumference of circle using classes in c++</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-show-basics-of-inline.html">Program to demonstrate inline functions in classes in c++</a> </span></span></span></li>
</ul><br />
<br />
<br />
<span style="font-size: small;"><span style="font-size: large;"><b>Programs of basics of graphics </b></span></span><br />
<ul><li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-print-rectangle-without.html">Program to print rectangle without using inbuilt functions in c++</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-print-rectangular-bowl.html">Program to print rectangular bowl without using inbuilt function</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-print-c-graphic-in-lines.html">Program to print 'c graphics' in the line without using inbuilt graphic functions in c++</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-print-menu-without-using.html">Program to print menu without using inbuilt graphics functions</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-of-loading.html">Program of loading in c++</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-of-loading-2.html">Program of loading 2 in c++</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-of-moving-boundries.html">Program to moving boundries like game in c++</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-print-all-ascii-values.html">Program to print all the ascii values of c++</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-print-barcode.html">Program to print a barcode in c++</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-print-line.html">Program to print a line in c++</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-print-welcome-screen.html">Program to print welcome screen in c++</a> </span></span></span></li>
</ul><br />
<br />
<br />
<b><span style="font-size: large;"> Programs of Advanced graphics </span></b><br />
<span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"></span></span></span><br />
<ul><li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-demonstrate-setfillstyle.html">Program to demonstrate the use of setfillstyle in c++</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-select-different-background.html">Program to select different background colours</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-which-demonstrate-text-style.html">Program which demonstrate the use of text styles in c++</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-demonstrate-line-style.html">Program which demonstrate use of line styles in c++</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-demonstrate-size-of-text.html">Program to demonstrate use of text size in c++</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-print-baby.html">Program to print a graphical baby in c++</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-of-loading-1.html">Program of graphical loading like window in c++</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-of-loading-2_01.html">Program to print graphical loading 2 like window loading in c++</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-print-mickey-mouse.html">Program to print mickey mouse in c++</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-print-variable-box.html">Program to print a variable box for text editor in c++</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-print-database-using-moving.html">Program to print database using lighted moving bulbs around the menu</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-print-menu-base-in-graphics.html">Program to print menu base in graphics in c++</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-print-menu-in-very-good.html">Program to print menu in very good graphics form</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-enter-values-in-student.html">Program to enter the values in student database in c++</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-enter-values-of-data-of-form.html">Program to enter the values of data of form in boxex and by pressing enter cursor goes to second box in c++</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-of-main-menu.html">Program to print main menu in graphics in c++</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-which-define-pixel-of-cursor.html">Program which define the pixel on screen while moving the mouse cursor on the screen ion c++</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-draw-lines-on-screen-with.html">Program to draw line with the help of mouse on the screen just like paint in c++</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-of-moving-3dimensional.html">Program of moving three dimensional rectangular box in c++</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-show-menu-with-cursor.html">Program of main menu working with mouse using c++</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-which-takes-number-from.html">Program which take a number from keyboard and returns its ascii value, scan code, status code in c++</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-which-draw-rectangles-on-screen.html">Program which draw rectangle with mouse just like paint in c++</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-of-digital-switches.html">Program of digital switches in c++</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-to-show-basics-os-screen-saver.html">Program to show the basics of screen saver in c++</a> </span></span></span></li>
<li><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"><a href="http://advance-programing.blogspot.com/2009/09/program-of-text-box.html">Program of text box in c++</a> <br />
</span></span></span></li>
</ul><span style="font-size: small;"><span style="font-size: large;"><span style="font-size: small;"> </span><b> </b></span><b><span style="font-size: large;"> </span></b><br />
</span>Upinder Singh Dhamihttp://www.blogger.com/profile/10526677796017634649noreply@blogger.com0tag:blogger.com,1999:blog-6297953299971051513.post-61746835029629304862009-11-02T00:10:00.001+05:302009-11-02T00:15:50.654+05:30<div style="color: blue;"><span style="font-size: large;"><b>If u have ur own code, u can post it here so that others can take benefit from it</b></span><br />
</div><div style="color: blue;"></div><iframe allowtransparency="true" frameborder="0" height="529" hspace="0" marginheight="0" marginwidth="0" scrolling="auto" src="http://formsmarts.com/form/adm?mode=embed&lay=2" style="overflow-x: hidden;" vspace="0" width="400">&amp;lt;p&amp;gt;&amp;amp;lt;a href="http://formsmarts.com/form/adm"&amp;amp;gt;Can&amp;amp;amp;#39;t see the form? Click &amp;amp;lt;br /&amp;amp;gt; here&amp;amp;lt;/a&amp;amp;gt;.&amp;lt;/p&amp;gt;</iframe><br />
<div style="margin: 3px 3px 10px; width: 540px;"><a href="http://formsmarts.com/" target="_blank" title="Form Creator">Form <br />
Creator</a> by <a href="http://formsmarts.com/" target="_blank" title="Web
form builder"><img alt="Create Form with FormSmarts" height="22" src="http://static.formsmarts.com/img/form_builder.png" style="border: 0pt none; vertical-align: middle;" width="104" /></a> - <a href="http://formsmarts.com/privacy" rel="nofollow" target="syronex_help" title="FormSmarts
Privacy Policy">Privacy</a><br />
</div><br />
<div style="color: red;"><span style="font-size: large;">If ur program is very big, u can also post it on this email: er.upinder.dhami@gmail.com</span><br />
</div>Upinder Singh Dhamihttp://www.blogger.com/profile/10526677796017634649noreply@blogger.com0tag:blogger.com,1999:blog-6297953299971051513.post-45447183302388007632009-11-02T00:03:00.001+05:302009-11-02T00:04:14.959+05:30<b><span style="font-size: x-large;">Projects and games<br />
</span></b><br />
<br />
<ul><li><a href="http://advance-programing.blogspot.com/2009/09/project-of-editorlike-notepad-in-c.html">Project of complete editor just like notepad in c++</a> </li>
<li><a href="http://advance-programing.blogspot.com/2009/09/project-of-banking.html">Project of banking in c++</a> </li>
<li><a href="http://advance-programing.blogspot.com/2009/09/project-of-hostel-management.html">Project of hostel management in c++</a> </li>
<li><a href="http://advance-programing.blogspot.com/2009/09/project-of-three-dimensional-calculator.html">Projetc of three dimensional calculator working with mouse in c++</a> </li>
<li><a href="http://advance-programing.blogspot.com/2009/09/graphical-project-of-students-database.html">Graphical project of student database in c++</a> </li>
<li><a href="http://advance-programing.blogspot.com/2009/09/graphical-project-of-students-database.html">Source code of shooting game in c++</a> </li>
</ul>Upinder Singh Dhamihttp://www.blogger.com/profile/10526677796017634649noreply@blogger.com0tag:blogger.com,1999:blog-6297953299971051513.post-53042952763870924352009-09-23T01:12:00.000+05:302010-01-23T01:13:15.917+05:30Two sentences are given and we were required to print the common word in the two sentences. Words were delimited by space, full stop, ? , ! and , . The trick in the question was that common word should be printed only once so if ur first sentence contains two word "how" and second contains "how" then in output how should be printed only once for this u can replace each matched word in second sentence by spaces .#include<iostream.h><br />
#include<conio.h><br />
#include<string.h><br />
#include<stdio.h><br />
void main()<br />
{ clrscr();<br />
char str1[500],str2[500];<br />
char substr1[50][50],substr2[50][50];<br />
for(int l=0;l<50;l++)<br />
{ strcpy(substr1[l],"");<br />
strcpy(substr2[l],"");<br />
}<br />
<br />
cout<<"enter the first string: ";<br />
gets(str1);<br />
cout<<"enter the second string: ";<br />
gets(str2);<br />
int i=0,index=0,s1index=0;<br />
<br />
while(str1[i]!='\0')<br />
{ if(str1[i]==' '||str1[i]=='?'||str1[i]=='.'||str1[i]=='!'||str1[i]=='_')<br />
{ for(int j=index, k=0;j<i;j++,k++)<br />
{ substr1[s1index][k]=str1[j];<br />
}<br />
<br />
substr1[s1index][k]='\0';<br />
s1index++;<br />
index=i+1;<br />
}<br />
i++;<br />
}<br />
index=0;<br />
s1index=0;<br />
i=0;<br />
while(str2[i]!='\0')<br />
{ if(str2[i]==' '||str2[i]=='?'||str2[i]=='.'||str2[i]=='!'||str2[i]=='_')<br />
{ for(int j=index, k=0;j<i;j++,k++)<br />
{ substr2[s1index][k]=str2[j];<br />
}<br />
<br />
substr2[s1index][k]='\0';<br />
s1index++;<br />
index=i+1;<br />
}<br />
i++;<br />
}<br />
cout<<"repeated words are: ";<br />
i=0;<br />
// for(int g=0;g<5;g++)<br />
// {cout<<substr1[g]<<endl;}<br />
// for(int d=0;d<5;d++)<br />
// {cout<<substr2[d]<<endl;}<br />
while(strcmp(substr1[i],"")!=0)<br />
{ int j=0;<br />
while(strcmp(substr2[j],"")!=0)<br />
{ if(strcmp(substr1[i],substr2[j])==0)<br />
cout<<substr1[i];<br />
j++;<br />
}<br />
i++;<br />
<br />
}<br />
getch();<br />
<br />
<br />
<br />
}Upinder Singh Dhamihttp://www.blogger.com/profile/10526677796017634649noreply@blogger.com0tag:blogger.com,1999:blog-6297953299971051513.post-86132561609468955732009-09-23T01:09:00.000+05:302010-01-23T01:10:17.036+05:30A string of charater is given.Find the highest occurance of a character and display that character. eg.: INPUT: AEGBCNAVNEETGUPTAEDAGPE. OUTPUT: E or I,J(if equal occurance)//to find the charater which is repeated most time in string<br />
#include<iostream.h><br />
#include<conio.h><br />
#include<stdio.h><br />
void main()<br />
{ clrscr();<br />
char ch;<br />
struct node<br />
{ char info;<br />
node *link;<br />
};<br />
node *start,*q,*p,*r;<br />
start=NULL;<br />
cout<<"enter the string: ";<br />
while((ch=getch())!='\r')<br />
{ cout<<ch;<br />
node *p=new node;<br />
p->info=ch;<br />
if(start==NULL)<br />
{ start=p;<br />
p->link=NULL;<br />
}<br />
else<br />
{ q=start;<br />
while(q->link!=NULL)<br />
{ q=q->link;<br />
}<br />
q->link=p;<br />
p->link=NULL;<br />
}<br />
}<br />
char record[50];<br />
int count[50],idx=0;<br />
for(int i=0;i<50;i++)<br />
{ record[i]=NULL;<br />
count[i]=0;<br />
}<br />
<br />
while(start!=NULL)<br />
{ p=start;<br />
ch=start->info;<br />
while(p!=NULL)<br />
{ q=p->link;<br />
if(q->info==ch)<br />
{ p->link=q->link;<br />
delete q;<br />
count[idx]++;<br />
continue;<br />
<br />
}<br />
p=p->link;<br />
}<br />
if(count[idx]==count[0])<br />
{ record[idx]=ch;<br />
<br />
idx++;<br />
}<br />
if(count[idx]>count[0])<br />
{ count[0]=count[idx];<br />
for(int i=1;i<50;i++)<br />
{ count[i]=0;<br />
record[i]=NULL;<br />
}<br />
<br />
idx=0;<br />
record[idx]=ch;<br />
idx++;<br />
}<br />
start=start->link;<br />
<br />
}<br />
cout<<"\nmaximum occurance numbers are: ";<br />
i=0;<br />
while(record[i]!=NULL)<br />
{ cout<<record[i]<<", ";<br />
i++;<br />
}<br />
<br />
getch();<br />
}Upinder Singh Dhamihttp://www.blogger.com/profile/10526677796017634649noreply@blogger.com0tag:blogger.com,1999:blog-6297953299971051513.post-42441428581209966392009-09-23T01:06:00.000+05:302010-01-23T01:07:28.672+05:30program to convert binary number into decimal number in c++//binary to decimal conversion<br />
#include<iostream.h><br />
#include<conio.h><br />
#include<math.h><br />
#include<stdlib.h><br />
void main()<br />
{ clrscr();<br />
int num[50];<br />
char ch,st[2];<br />
for(int i=0;i<50;i++)<br />
num[i]=-1;<br />
<br />
i=0;<br />
cout<<"enter the binary number: ";<br />
while((ch=getch())!='\r')<br />
{<br />
cout<<ch;<br />
st[0]=ch;<br />
st[1]='\0';<br />
num[i]=atoi(st);<br />
i++;<br />
}<br />
int max=0,sum=0,m=0;<br />
while(num[max]!=-1)<br />
max++;<br />
<br />
max--;<br />
cout<<endl<<endl;<br />
while(max>=0)<br />
{ sum=sum+(num[max]*pow(2,m));<br />
max--;m++;<br />
}<br />
cout<<endl<<sum;<br />
getch();<br />
<br />
}Upinder Singh Dhamihttp://www.blogger.com/profile/10526677796017634649noreply@blogger.com0tag:blogger.com,1999:blog-6297953299971051513.post-47436733815373388682009-09-23T01:01:00.000+05:302010-01-23T01:03:59.571+05:30there is a matrix N x N .Its elements consist of either value =1 or value=0. If there is a any zero in the row, then the output matrix should have all zeroes in that row. If there is a single zero in any column then that column should have all zeroes n the output matrix.#include<iostream.h><br />
#include<conio.h><br />
void main()<br />
{ clrscr();<br />
int mat[50][50],r,c,stack[500],id=0;<br />
for(int i=0;i<500;i++)<br />
stack[i]=-1;<br />
<br />
cout<<"enter the number of rows and columns resp: ";<br />
cin>>r>>c;<br />
cout<<"enter the elements: ";<br />
for(i=0;i<r;i++)<br />
{ for(int j=0;j<c;j++)<br />
{ cin>>mat[i][j];<br />
}<br />
}<br />
cout<<"ur entered matrix is: "<<endl;<br />
for(i=0;i<r;i++)<br />
{ for(int j=0;j<c;j++)<br />
{ cout<<mat[i][j]<<" ";<br />
}<br />
cout<<endl;<br />
}<br />
<br />
for(i=0;i<r;i++)<br />
{ for(int j=0;j<c;j++)<br />
{ if(mat[i][j]==0)<br />
{ stack[id]=i;<br />
id++;<br />
stack[id]=j;<br />
id++;<br />
}<br />
}<br />
}<br />
int k=0;<br />
<br />
while(stack[k]!=-1)<br />
{ for(i=0;i<r;i++)<br />
{ for(int j=0;j<c;j++)<br />
{ mat[(stack[k])][j]=0;<br />
}<br />
mat[i][(stack[k+1])]=0;<br />
}<br />
k+=2;<br />
}<br />
cout<<"after ur operation ur matrix become:\n";<br />
for(i=0;i<r;i++)<br />
{ for(int j=0;j<c;j++)<br />
{ cout<<mat[i][j]<<" ";<br />
}<br />
cout<<endl;<br />
}<br />
<br />
getch();<br />
}Upinder Singh Dhamihttp://www.blogger.com/profile/10526677796017634649noreply@blogger.com0tag:blogger.com,1999:blog-6297953299971051513.post-37503564048673362272009-09-21T22:16:00.002+05:302010-02-03T21:49:13.286+05:30Solved Placement papers of different IT companies<b style="color: blue;"><span style="font-size: large;">Solved C& C++ technical paper of Nagarro</span></b><br />
<ul><li><a href="http://advance-programing.blogspot.com/2010/01/string-of-charater-is-givenfind-highest.html">A string of charater is given.Find the highest occurance of a character and display that character. eg.: INPUT: AEGBCNAVNEETGUPTAEDAGPE, OUTPUT: E or I,J(if equal occurance)</a> </li>
<li><a href="http://advance-programing.blogspot.com/2009/09/two-sentences-are-given-and-we-were.html">Two sentences are given and we were required to print the common word in the two sentences. Words were delimited by space, full stop, ? , ! and , . The trick in the question was that common word should be printed only once so if ur first sentence contains two word "how" and second contains "how" then in output how should be printed only once for this u can replace each matched word in second sentence by spaces </a> </li>
<li><a href="http://advance-programing.blogspot.com/2009/09/there-is-matrix-n-x-n-its-elements.html">there is a matrix N x N .Its elements consist of either value =1 or value=0. If there is a any zero in the row, then the output matrix should have all zeroes in that row. If there is a single zero in any column then that column should have all zeroes n the output matrix. write the function to perform these operations</a> </li>
<li><a href="http://advance-programing.blogspot.com/2009/09/program-to-convert-binary-number-into.html">Program to convert binary number into decimal number in c++</a></li>
<li><a href="http://advance-programing.blogspot.com/2010/02/write-program-to-check-whether-given.html">write a program to check whether the given number was of the form 3^n. ( i.e. 3 to the power n).</a> </li>
<li><a href="http://advance-programing.blogspot.com/2010/02/there-are-two-sorted-arrays-a1-and-a2.html">There are two sorted arrays, a1 and a2 of size n1 and size n2 respectively. array a1 is full, array a2 has exactly n1(size of array a1) empty space. Example, a1[]=1234, a2[]=56789_ _ _ _ Write a function to merge these two arrays to form a sorted array without any extra memory use.</a> </li>
<li><a href="http://advance-programing.blogspot.com/2010/02/suppose-u-r-given-43-rectangle-like.html">suppose u r given a 4*3 rectangle like (take these values from user) Now u have to calculate the no. of squares in this rectangle like: No. of squares of dimension 1 is 12 No. of squares of dimension 2 is 6 No. of squares of dimension 3 is 2 No. of squares of dimension 4 is 0 Total no. of squares are 20.</a><br />
</li>
</ul>Upinder Singh Dhamihttp://www.blogger.com/profile/10526677796017634649noreply@blogger.com0tag:blogger.com,1999:blog-6297953299971051513.post-91244581648644963562009-09-10T21:32:00.000+05:302009-09-10T21:32:18.808+05:30Program to find the factorial of a large number#include<iostream.h><br />
#include<conio.h><br />
void main()<br />
{<br />
clrscr();<br />
int num,i,k,a[200],temp,index,n,x,test;<br />
cout<<"enter the no. of test cases";<br />
cin>>test;<br />
while(test>0)<br />
{<br />
cout<<endl<<"enter the number ";<br />
cin>>num;<br />
k=num;<br />
for(i=0;k>=1;i++)<br />
{<br />
a[i]=k%10;<br />
k=k/10;<br />
}<br />
<br />
<br />
for(n=1;n<num;n++)<br />
{<br />
temp=0;<br />
<br />
for(index=0;index<i;index++)<br />
{<br />
x=a[index]*n+temp;<br />
a[index]=x%10;<br />
temp=x/10;<br />
}<br />
<br />
while(temp!=0)<br />
{<br />
a[index]=temp%10;<br />
temp=temp/10;<br />
index++;<br />
i++;<br />
}<br />
}<br />
for(i=index-1;i>=0;i--)<br />
cout<<a[i];<br />
test--;}<br />
clrscr();<br />
cout<<"made by anil";<br />
<br />
getch();<br />
<br />
<br />
<br />
}Upinder Singh Dhamihttp://www.blogger.com/profile/10526677796017634649noreply@blogger.com2tag:blogger.com,1999:blog-6297953299971051513.post-32335094942261415412009-09-01T18:43:00.001+05:302009-09-01T18:43:15.344+05:30project of shooting game#include<iostream.h><br />
#include<alloc.h><br />
#include<dos.h><br />
#include<conio.h><br />
#include<stdlib.h>;<br />
#include<graphics.h><br />
void front_page();<br />
void second_page();<br />
void final_page();<br />
long o=0,g=0,a=20;<br />
float v;<br />
char w;<br />
void main()<br />
{ int gde=DETECT,gme;<br />
initgraph(&gde,&gme,"c:\\tc");<br />
mit: //label<br />
front_page();<br />
w=getch();<br />
switch(w)<br />
{ case '1':v=1.2; break;<br />
case '2':v=2.0; break;<br />
case '3':v=5; break;<br />
default: goto mit;<br />
}<br />
cleardevice();<br />
int c=0;<br />
char *h;<br />
second_page();<br />
int maxx,maxy,area,x=580,ch,xdirn=1,ydirn=1;<br />
float y=25;<br />
void *buff;<br />
setcolor(WHITE);<br />
setfillstyle(SOLID_FILL,RED );<br />
circle(605,50,25);<br />
floodfill(605,50,WHITE);<br />
area=imagesize(580,25,630,75);<br />
buff=malloc(area);<br />
getimage(580,25,630,75,buff);<br />
maxx=getmaxx();<br />
maxy=getmaxy();<br />
while(1)<br />
{ putimage(x,y,buff,XOR_PUT);<br />
//delay(0);<br />
y=y+(ydirn*v);<br />
putimage(x,y,buff,XOR_PUT);<br />
if(y>maxy-50||y<20)<br />
{ c=0;<br />
sound(130);<br />
delay(5);<br />
nosound();<br />
ydirn*=-1;<br />
}<br />
int marea,m=98,n=235,ch,mdirn=1,ndirn=1,mn;<br />
int maxm,maxn,narea,buffn;<br />
void *buffe;<br />
setcolor(DARKGRAY);<br />
setfillstyle(SOLID_FILL,DARKGRAY );<br />
rectangle(98,235,105,239);<br />
floodfill(101,237,DARKGRAY);<br />
marea=imagesize(98,235,105,239);<br />
buffe=malloc(marea);<br />
getimage(98,235,105,239,buffe);<br />
maxm=getmaxx();<br />
maxn=getmaxy();<br />
gotoxy(2,10);<br />
int in;<br />
cout<<"BULLETS REMAINING = ";<br />
for(in=0;in<=a-1;in++)<br />
{ cout<<"!";<br />
}<br />
if(kbhit())<br />
{ mn=getch();<br />
char *bul;<br />
if(a==0)<br />
break;<br />
if((mn==115||mn==83) &&c==0)<br />
{ a=a-1;<br />
cout<<0;<br />
sound(9999);<br />
delay(10);<br />
c++;<br />
nosound();<br />
while(m<=maxm)<br />
{ putimage(m,n,buffe,XOR_PUT);<br />
m=m+(mdirn*2);<br />
delay(0);<br />
putimage(m,n,buffe,XOR_PUT);<br />
gotoxy(11,3);<br />
cout<<g;<br />
if(m==maxm-51 && (y<=235 && y+25>=205))<br />
{ g=g+10;<br />
o=g;<br />
sound(2200);<br />
delay(900);<br />
putimage(700,25,buff,XOR_PUT);<br />
nosound();<br />
}<br />
}<br />
}<br />
else<br />
{ if(mn==27)<br />
break;<br />
}<br />
}<br />
}<br />
cleardevice();<br />
final_page();<br />
getch();<br />
closegraph();<br />
}<br />
void front_page()<br />
{ setbkcolor(GREEN);<br />
setcolor(WHITE);<br />
setfillstyle(SOLID_FILL,RED );<br />
circle(505,190,50);<br />
floodfill(505,190,WHITE);<br />
setcolor(BROWN);<br />
line(0,235,35,235);<br />
line(0,235,0,258);<br />
line(35,240,35,235);<br />
line(0,258,35,240);<br />
setfillstyle(1,BROWN);<br />
floodfill(2,240,BROWN);<br />
setcolor(DARKGRAY);<br />
line(35,235,102,235);<br />
line(35,240,35,235);<br />
line(35,240,102,240);<br />
line(102,235,102,240);<br />
setfillstyle(1,DARKGRAY);<br />
floodfill(99,236,DARKGRAY);<br />
arc(35,220,250,310,25);<br />
line(35,242,38,243);<br />
settextstyle(1,0,1);<br />
setcolor(BLUE);<br />
outtextxy(200,300,"MADE BY :- MOHIT VASHISHT");<br />
outtextxy(200,317,"E_MAIL :- mohitvashisht88@yahoo.com");<br />
settextstyle(4,0,5);<br />
outtextxy(200,50,"SHOOTING");<br />
outtextxy(250,120,"GAME");<br />
gotoxy(20,12);<br />
cout<<" 1 : EASY";<br />
gotoxy(20,13);<br />
cout<<" 2 : MEDIUM";<br />
gotoxy(20,14);<br />
cout<<" 3 : TOUGH";<br />
gotoxy(10,16);<br />
cout<<"ENTER THE LEVEL = ";<br />
}<br />
void second_page()<br />
{ setcolor(BROWN);<br />
setbkcolor(YELLOW);<br />
line(0,235,35,235);<br />
line(0,235,0,258);<br />
line(35,240,35,235);<br />
line(0,258,35,240);<br />
setfillstyle(1,BROWN);<br />
floodfill(2,240,BROWN);<br />
setcolor(DARKGRAY);<br />
line(35,235,102,235);<br />
line(35,240,35,235);<br />
line(35,240,102,240);<br />
line(102,235,102,240);<br />
setfillstyle(1,DARKGRAY);<br />
floodfill(99,236,DARKGRAY);<br />
arc(35,220,250,310,25);<br />
line(35,242,38,243);<br />
outtextxy(10,35,"SCORE");<br />
outtextxy(10,50,"FIRE");<br />
outtextxy(50,50,"S");<br />
outtextxy(10,65,"EXIT");<br />
outtextxy(50,65,"esc");<br />
}<br />
void final_page()<br />
{ setcolor(BROWN);<br />
setbkcolor(RED);<br />
for(int x=1;x<=4;x++)<br />
{<br />
clrscr();<br />
setbkcolor(RED);<br />
delay(100);<br />
gotoxy(31,12);<br />
cout<<"YOUR SCORE = "<<o;<br />
sound(2200);<br />
delay(750);<br />
nosound();<br />
}<br />
gotoxy(28,16);<br />
cout<<"PRESS ANY KEY TO EXIT";<br />
}Upinder Singh Dhamihttp://www.blogger.com/profile/10526677796017634649noreply@blogger.com4tag:blogger.com,1999:blog-6297953299971051513.post-64412016164764439102009-09-01T18:41:00.001+05:302009-09-01T18:41:46.180+05:30graphical project of students database#include<iostream.h><br />
#include<conio.h><br />
#include<stdio.h><br />
#include<string.h><br />
#include<process.h><br />
#include<fstream.h><br />
#include<dos.h><br />
#include<graphics.h><br />
#include "c:/tc/file1.cpp"<br />
#include "c:/tc/file2.cpp"<br />
char fname[]="c:/temp1.bin";<br />
<br />
class student<br />
{<br />
char name[20],fees[20],rollno[20],e_mail[20];<br />
public:<br />
int input();<br />
void output(int,int);<br />
int compare(char r[]);<br />
};<br />
<br />
struct node<br />
{<br />
student info;<br />
node *link;<br />
};<br />
<br />
class linklist<br />
{<br />
node * start;<br />
public:<br />
linklist()<br />
{<br />
start=NULL;<br />
}<br />
void file2list();<br />
void list2file();<br />
void insert(student);<br />
void show();<br />
void search();<br />
void delete1();<br />
void modify();<br />
};<br />
<br />
<br />
void linklist::file2list()<br />
{<br />
ifstream f;<br />
f.open(fname,ios::binary);<br />
student n;<br />
if(f.fail())<br />
{<br />
cout<<"\n FILE COULD NOT BE OPENED:";<br />
return;<br />
}<br />
while(1)<br />
{<br />
f.read((char*)&n,sizeof(n));<br />
if(f.eof())<br />
break;<br />
insert(n);<br />
}<br />
f.close();<br />
}<br />
<br />
<br />
void linklist::list2file()<br />
{<br />
ofstream f;<br />
f.open(fname,ios::binary);<br />
student n;<br />
node*p=start;<br />
while(p!=NULL)<br />
{<br />
n=p->info;<br />
f.write((char*)&n,sizeof(n));<br />
p=p->link;<br />
}<br />
f.close();<br />
}<br />
<br />
<br />
int student::input()<br />
{<br />
char s[4][50];<br />
int a;<br />
a=showform(s,4);<br />
if(a==0)<br />
return 0;<br />
else<br />
{<br />
strcpy(rollno,s[0]);<br />
strcpy(name,s[1]);<br />
strcpy(fees,s[2]);<br />
strcpy(e_mail,s[3]);<br />
return 1;<br />
}<br />
}<br />
<br />
void student::output(int x,int y)<br />
{<br />
outtextxy(x,y,rollno);<br />
outtextxy(x+100,y,name);<br />
outtextxy(x+200,y,fees);<br />
outtextxy(x+300,y,e_mail);<br />
<br />
}<br />
<br />
<br />
int student::compare(char r[10])<br />
{<br />
if(strcmp(rollno,r)==0)<br />
{<br />
return 1;<br />
}<br />
else<br />
{<br />
return 0;<br />
}<br />
}<br />
<br />
void linklist::delete1()<br />
{ char temp[20];<br />
cout<<"Enter the roll no. whose record u want to delete:-> ";<br />
gets(temp);<br />
student n;<br />
node *p,*q;<br />
int i=0;<br />
p=start;<br />
q=p->link;<br />
if(start==NULL)<br />
{ cout<<"Linked list is empty";<br />
getch();<br />
return;<br />
}<br />
while(q!=NULL)<br />
{ n=q->info;<br />
if(n.compare(temp)==1)<br />
{ i++;<br />
p->link=q->link;<br />
q->link=NULL;<br />
delete q;<br />
cout<<"\n\n Record is successfully deleted";<br />
break;<br />
<br />
}<br />
p=p->link;<br />
q=q->link;<br />
}<br />
<br />
if(i==0)<br />
cout<<"\n\n\n NO RECORD FOUND";<br />
<br />
<br />
}<br />
void linklist::search()<br />
{<br />
student n;<br />
char k[10];<br />
cout<<"\n ENTER THE ROLL NO THAT U WANT TO SEARCH:";<br />
cin>>k;<br />
int z=0;<br />
node *p=start;<br />
while(p!=NULL)<br />
{<br />
n=p->info;<br />
if(n.compare(k)==1)<br />
{<br />
cout<<"\n RECORD IS FOUND:";<br />
n.output(100,80);<br />
z++;<br />
}<br />
p=p->link;<br />
}<br />
if(z==0)<br />
{<br />
cout<<"\n RECORD IS NOT FOUND:";<br />
}<br />
}<br />
<br />
<br />
void linklist::insert(student n)<br />
{<br />
node*q=new node;<br />
q->info=n;<br />
q->link=NULL;<br />
if(start==NULL)<br />
{<br />
start=q;<br />
}<br />
else<br />
{<br />
node* p=start;<br />
while(p->link!=NULL)<br />
{<br />
p=p->link;<br />
}<br />
p->link=q;<br />
}<br />
}<br />
<br />
void linklist::show()<br />
{<br />
cleardevice();<br />
student n;<br />
node *p=start;<br />
int a=10,b=30;<br />
while(p!=NULL)<br />
{<br />
n=p->info;<br />
n.output(a,b);<br />
b+=30;<br />
p=p->link;<br />
}<br />
}<br />
<br />
void linklist::modify()<br />
{<br />
char temp[20];<br />
cout<<"enter the roll no. whose record u want to modify:-> ";<br />
gets(temp);<br />
student n;<br />
node *p,*q;<br />
int i=0;<br />
p=start;<br />
q=p->link;<br />
if(start==NULL)<br />
{ cout<<"\n\n\n Linked list is empty";<br />
getch();<br />
return;<br />
}<br />
while(q!=NULL)<br />
{ n=q->info;<br />
if(n.compare(temp)==1)<br />
{ i++;<br />
cout<<"Privious record is:-> "<<endl;<br />
n.output(100,80);<br />
getch();<br />
cleardevice();<br />
cout<<"\n\n Now enter new record:-> ";<br />
n.input();<br />
q->info=n;<br />
cout<<"\n\n\n\n\n\n\n\n\n\n Record is successfully modify";<br />
break;<br />
}<br />
p=p->link;<br />
q=q->link;<br />
}<br />
<br />
if(i==0)<br />
cout<<"\n\n NO RECORD FOUND";<br />
<br />
}<br />
<br />
void main()<br />
{<br />
int d,m;<br />
d=DETECT;<br />
initgraph(&d,&m,"c:/tc");<br />
<br />
student n;<br />
char choice;<br />
linklist l;<br />
l.file2list();<br />
while(1)<br />
{<br />
cleardevice();<br />
choice=mmenu();<br />
cleardevice();<br />
setbkcolor(0);<br />
settextstyle(0,0,0);<br />
switch (choice)<br />
{<br />
case 1:<br />
if(n.input()==1)<br />
{<br />
l.insert(n);<br />
l.list2file();<br />
}<br />
break;<br />
<br />
case 2:<br />
l.show();<br />
break;<br />
case 3:<br />
l.search();<br />
break;<br />
case 4:<br />
l.delete1();<br />
l.list2file();<br />
break;<br />
case 5:<br />
l.modify();<br />
l.list2file();<br />
break;<br />
case 6:<br />
exit(0);<br />
}<br />
getch();<br />
}<br />
}<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
?///////////////////////////////////////////////////////////////////////////////////<br />
//////////////////////////file1////////////////////////////////////////////////////<br />
<br />
<br />
#include<iostream.h><br />
#include<conio.h><br />
#include<stdio.h><br />
#include<graphics.h><br />
#include<dos.h><br />
#include<process.h><br />
int color;<br />
void arrow(int xx,int yy,int color)<br />
{ setcolor(color);<br />
int a[]={xx-50,yy+7,xx-40,yy+7,xx-20,yy+20,xx-40,yy+33,xx-50,yy+33,xx-50,yy+26,xx-40,yy+26,xx-27,yy+20,xx-40,yy+14,xx-50,yy+14,xx-50,yy+7};<br />
drawpoly(11,a);<br />
setfillstyle(1,color);<br />
floodfill(xx-40,yy+10,color);<br />
}<br />
<br />
void msetfocus(int l,int r,int t,int b,char s[])<br />
{ arrow(l,t,8);<br />
setcolor(15);<br />
rectangle(l,t,r,b);<br />
setfillstyle(1,15);<br />
floodfill(l+2,t+2,15);<br />
setcolor(6);<br />
outtextxy(l+5,t,s);<br />
}<br />
<br />
void mlostfocus(int l,int r,int t,int b,char s[])<br />
{ arrow(l,t,7);<br />
setcolor(7);<br />
rectangle(l,t,r,b);<br />
setfillstyle(1,7);<br />
floodfill(l+2,t+2,7);<br />
setcolor(6);<br />
outtextxy(l+5,t,s);<br />
}<br />
<br />
void men(char x[][50],int msize,int hl)<br />
{<br />
int lf,tp,rh,bt;<br />
lf=175;<br />
rh=lf+225;<br />
tp=150;<br />
bt=tp+40;<br />
setcolor(5);<br />
settextstyle(1,HORIZ_DIR,4);<br />
outtextxy(140,60,x[0]);<br />
<br />
settextstyle(1,HORIZ_DIR,2);<br />
for(int i=1;i<=msize;i++)<br />
{ if(i==hl)<br />
msetfocus(lf,rh,tp,bt,x[i]);<br />
else<br />
mlostfocus(lf,rh,tp,bt,x[i]);<br />
tp+=40;<br />
bt+=40;<br />
}<br />
}<br />
<br />
void getkey(int &j,int &k,int &l)<br />
{ REGS n,m;<br />
m.h.ah=0X00;<br />
int86(22,&m,&n);<br />
j=n.h.ah;<br />
k=n.h.al;<br />
m.h.ah=0X02;<br />
int86(22,&m,&n);<br />
l=n.h.al;<br />
}<br />
<br />
int mmenu()<br />
{<br />
settextstyle(1,HORIZ_DIR,2);<br />
setbkcolor(7);<br />
int ac,sc,st,z=1;<br />
char mstr[][50]={"STUDEMT'S DATABASE","INSERT NEW RECORD ","SHOW ALL RECORD","SEARCH A RECORD","DELETE A RECORD ","MODIFY A RECORD","EXIT"};<br />
while(1)<br />
{<br />
men(mstr,6,z);<br />
getkey(sc,ac,st);<br />
/*sound(7);<br />
delay(100);<br />
nosound(); */<br />
if(sc==72 && z>=1)<br />
{<br />
if(z==1)<br />
{ z=6;<br />
continue;<br />
}<br />
z--;<br />
}<br />
else if(sc==80&& z<=6)<br />
{<br />
z++;<br />
if(z==7)<br />
z=1;<br />
}<br />
else if(sc==1)<br />
return 0;<br />
<br />
else if(sc==28)<br />
{ return z;<br />
}<br />
}<br />
getch();<br />
}<br />
<br />
<br />
<br />
<br />
<br />
//////////////////////////////////////////////////////////////////////////<br />
/////////////////////////file2///////////////////////////////////////////<br />
<br />
<br />
void setfocus(int,int,int,int,char*);<br />
void lostfocus(int,int,int,int,char*);<br />
void lostfocus1(int,int,int,int,char*);<br />
<br />
int showform(char str[][50],int n)<br />
{<br />
cleardevice();<br />
int z;<br />
int cur=0,max=0;<br />
int lf=200,rh=320,tp=20,bt=40;<br />
char s1[2],s2[50];<br />
int s,a,p;<br />
<br />
strcpy(s2,"");<br />
outtextxy(50,28,"ROLL NO.->");<br />
outtextxy(50,78,"NAME ->");<br />
outtextxy(50,128,"FEE ->");<br />
outtextxy(50,178,"E_MAIL ->");<br />
setfocus(lf,tp,rh,bt,s2);<br />
<br />
for(int i=0;i<n;i++)<br />
strcpy(str[i],"");<br />
<br />
while(1)<br />
{<br />
getkey(s,a,p);<br />
z=p&4;<br />
if(s==1)<br />
return 0;<br />
else if(z==4 && s==31 )<br />
return 1;<br />
// up arrow key<br />
<br />
else if(s==72)<br />
{<br />
if(cur>0)<br />
{<br />
lostfocus1(lf,tp,rh,bt,str[cur]);<br />
lostfocus(lf,tp,rh,bt,str[cur]);<br />
cur--;<br />
strcpy(s2,str[cur]);<br />
tp=tp-50;<br />
bt=tp+20;<br />
}<br />
}<br />
// down arrow key<br />
<br />
else if(s==80)<br />
{<br />
if(cur<=max-1)<br />
{<br />
lostfocus1(lf,tp,rh,bt,str[cur]);<br />
lostfocus(lf,tp,rh,bt,str[cur]);<br />
cur++;<br />
strcpy(s2,str[cur]);<br />
tp=tp+50;<br />
bt=tp+20;<br />
}<br />
}<br />
<br />
// enter key<br />
<br />
else if(a==13)<br />
{<br />
if(strlen(s2)!=0)<br />
{<br />
strcpy(str[cur],s2);<br />
<br />
if(max<n-1)<br />
{<br />
max++;<br />
}<br />
if(cur<=max-1)<br />
{<br />
cur++;<br />
lostfocus(lf,tp,rh,bt,s2);<br />
if(cur==max&&max<n-1)<br />
strcpy(s2,"");<br />
else<br />
strcpy(s2,str[cur]);<br />
<br />
tp=tp+50;<br />
bt=tp+20;<br />
}<br />
}<br />
}<br />
else<br />
{<br />
if(a==8)<br />
{<br />
<br />
//code for backspace key<br />
if(strlen(s2)>0)<br />
s2[strlen(s2)-1]='\0';<br />
}<br />
else<br />
{<br />
// code for any other alphabet<br />
<br />
s1[0]=a;<br />
s1[1]='\0';<br />
strcat(s2,s1);<br />
}<br />
}<br />
setfocus(lf,tp,rh,bt,s2);<br />
<br />
<br />
}<br />
}<br />
<br />
// Function to write the string in the text box<br />
<br />
void setfocus(int a,int b,int c,int d,char *f)<br />
{<br />
setcolor(GREEN);<br />
rectangle(a,b,c,d);<br />
setfillstyle(SOLID_FILL,BLACK);<br />
floodfill(a+2,b+2,GREEN);<br />
setcolor(YELLOW);<br />
outtextxy(a+3,b+3,f);<br />
}<br />
<br />
// Function to wash the rectangle in black<br />
<br />
void lostfocus(int a,int b,int c,int d,char *f)<br />
{<br />
setcolor(BLACK);<br />
rectangle(a,b,c,d);<br />
setfillstyle(SOLID_FILL,BLACK);<br />
floodfill(a+2,b+2,BLACK);<br />
setcolor(WHITE);<br />
outtextxy(a+3,b+3,f);<br />
}<br />
<br />
// Function called before lostfocus to wash the rectangle<br />
<br />
void lostfocus1(int a,int b,int c,int d,char *f)<br />
{<br />
setcolor(BLUE);<br />
rectangle(a,b,c,d);<br />
setfillstyle(SOLID_FILL,BLACK);<br />
floodfill(a+2,b+2,BLUE);<br />
setcolor(WHITE);<br />
outtextxy(a+3,b+3,f);<br />
}Upinder Singh Dhamihttp://www.blogger.com/profile/10526677796017634649noreply@blogger.com0tag:blogger.com,1999:blog-6297953299971051513.post-74565474476580759062009-09-01T18:40:00.003+05:302009-09-01T21:44:58.829+05:30project of three dimensional calculator working with mouse#include<iostream.h><br />
#include<conio.h><br />
#include<stdio.h><br />
#include<graphics.h><br />
#include<dos.h><br />
#include<string.h><br />
#include<stdlib.h><br />
#include<math.h><br />
#include<process.h><br />
<br />
int aaa=247,bbb=167,l2,status,rep=0,mul=0;<br />
char ch,st2[50],st1[2];<br />
double f1=0,f2=0,d1=0,d2=0,d3=0;<br />
void buttan1(int,int,int,int);<br />
void buttan(int,int,int,int);<br />
void text();<br />
void screen(char);<br />
void scremt();<br />
void main()<br />
{ int d,mm,e,a,b,c,k;<br />
d=DETECT;<br />
initgraph(&d,&mm,"c:/tc");<br />
e=graphresult();<br />
<br />
if(e!=0)<br />
{<br />
cout<<"Graphics not inialised";<br />
getch();<br />
return;<br />
}<br />
<br />
setbkcolor(BLUE);<br />
setcolor(7);<br />
rectangle(aaa-10,bbb-50,aaa+153,bbb+150);<br />
setfillstyle(1,7);<br />
floodfill(aaa,bbb,7);<br />
<br />
setcolor(15);<br />
int f[]={aaa-15,bbb-55,aaa+158,bbb-55,aaa+153,bbb-50,aaa-10,bbb-50,aaa-10,bbb+150,aaa-15,bbb+155,aaa-15,bbb-55};<br />
drawpoly(7,f);<br />
setfillstyle(1,15);<br />
floodfill(aaa-12,bbb-42,15);<br />
<br />
setcolor(8);<br />
int h[]={aaa+158,bbb-55,aaa+158,bbb+155,aaa-15,bbb+155,aaa-10,bbb+150,aaa+153,bbb+150,aaa+153,bbb-50,aaa+158,bbb-55};<br />
drawpoly(7,h);<br />
setfillstyle(1,8);<br />
floodfill(aaa+156,bbb-40,8);<br />
<br />
for(int ii=1;ii<17;ii++)<br />
{<br />
buttan(aaa,bbb,15,8);<br />
aaa+=39;<br />
if(ii%4==0)<br />
{ bbb+=39;<br />
aaa=247;<br />
}<br />
}<br />
buttan1(236,75,15,8);<br />
buttan1(350,75,15,8);<br />
aaa=247;<br />
bbb=167;<br />
text();<br />
scremt();<br />
<br />
<br />
REGS n,m;<br />
n.x.ax=0;<br />
int86(0x33,&n,&m);<br />
k=m.x.ax;<br />
if(k==0)<br />
return;<br />
int aa,bb,t1,t2;<br />
while(1)<br />
{ n.x.ax=1;<br />
int86(0x33,&n,&m);<br />
n.x.ax=3;<br />
int86(0x33,&n,&m);<br />
a=m.x.cx;<br />
b=m.x.dx;<br />
c=m.x.bx;<br />
// FOR EXIT XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<br />
if(c==1 && a>350 && a<400 && b>75 && b<100)<br />
{ buttan1(350,75,8,15);<br />
delay(200);<br />
cleardevice();<br />
cleardevice();<br />
setcolor(RED);<br />
outtextxy(50,50,"MADE BY:");<br />
outtextxy(50,80,"UPINDER SINGH DHAMI");<br />
outtextxy(50,110,"B.TECH (FIFTH SEM)");<br />
outtextxy(50,140,"ELECTRONICS AND COMM ENGG");<br />
outtextxy(50,170,"GURU NANAK DEV UNIVERSITY (AMRITSAR)");<br />
outtextxy(50,200,"DATE: 17\\07\\2008");<br />
delay(7000);<br />
return;<br />
}<br />
// FOR RECET XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<br />
if(c==1 && a>236 && a<286 && b>75 && b<100)<br />
{ rep=0;<br />
mul=0;<br />
buttan1(236,75,8,15);<br />
delay(200);<br />
buttan1(236,75,15,8);<br />
strcpy(st2,"");<br />
screen(' ');<br />
scremt();<br />
}<br />
<br />
// FOR FIRST ROW XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<br />
// FOR 7<br />
if(c==1 && a>aaa && a<(aaa+25) && b>bbb && b<(bbb+25))<br />
{<br />
buttan(aaa,bbb,8,15);<br />
delay(200);<br />
buttan(aaa,bbb,15,8);<br />
screen('7');<br />
mul=0;<br />
continue;<br />
}<br />
<br />
// FOR 8<br />
if(c==1 && a>(aaa+39) && a<(aaa+64) && b>bbb&&b<(bbb+25))<br />
{<br />
buttan((aaa+39),bbb,8,15);<br />
delay(200);<br />
buttan((aaa+39),bbb,15,8);<br />
screen('8');<br />
mul=0;<br />
continue;<br />
}<br />
<br />
// FOR 9<br />
if(c==1 && a>(aaa+78) && a<(aaa+103) && b>bbb&&b<(bbb+25))<br />
{<br />
buttan((aaa+78),bbb,8,15);<br />
delay(200);<br />
buttan((aaa+78),bbb,15,8);<br />
screen('9');<br />
mul=0;<br />
continue;<br />
}<br />
<br />
// FOR +<br />
if(c==1 && a>(aaa+117) && a<(aaa+142) && b>bbb&&b<(bbb+25))<br />
{ rep++;<br />
mul++;<br />
if(mul==2)<br />
{ rep--;<br />
mul--;<br />
}<br />
if(rep==2)<br />
goto label;<br />
status=2;<br />
buttan((aaa+117),bbb,8,15);<br />
delay(200);<br />
buttan((aaa+117),bbb,15,8);<br />
d1=f1;<br />
strcpy(st2,"");<br />
scremt();<br />
continue;<br />
}<br />
<br />
//FOR SECOND ROW XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<br />
// FOR 4<br />
if(c==1 && a>aaa && a<(aaa+25) && b>(bbb+39) && b<(bbb+64))<br />
{<br />
buttan(aaa,bbb+39,8,15);<br />
delay(200);<br />
buttan(aaa,bbb+39,15,8);<br />
screen('4');<br />
mul=0;<br />
continue;<br />
}<br />
<br />
//FOR 5<br />
if(c==1 && a>(aaa+39) && a<(aaa+64) && b>(bbb+39) && b<(bbb+64))<br />
{<br />
buttan(aaa+39,bbb+39,8,15);<br />
delay(200);<br />
buttan(aaa+39,bbb+39,15,8);<br />
screen('5');<br />
mul=0;<br />
continue;<br />
}<br />
<br />
//FOR 6<br />
if(c==1 && a>(aaa+78) && a<(aaa+103) && b>(bbb+39) && b<(bbb+64))<br />
{<br />
buttan(aaa+78,bbb+39,8,15);<br />
delay(200);<br />
buttan(aaa+78,bbb+39,15,8);<br />
screen('6');<br />
mul=0;<br />
continue;<br />
}<br />
<br />
//FOR -<br />
if(c==1 && a>(aaa+117) && a<(aaa+142) && b>(bbb+39) && b<(bbb+64))<br />
{ rep++;<br />
mul++;<br />
if(mul==2)<br />
{ rep--;<br />
mul--;<br />
}<br />
if(rep==2)<br />
goto label;<br />
status=3;<br />
buttan(aaa+117,bbb+39,8,15);<br />
delay(200);<br />
buttan(aaa+117,bbb+39,15,8);<br />
d1=f1;<br />
strcpy(st2,"");<br />
scremt();<br />
continue;<br />
}<br />
<br />
// FOR THIRD ROW XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<br />
// FOR 1<br />
if(c==1 && a>aaa && a<(aaa+25) && b>(bbb+78) && b<(bbb+103))<br />
{<br />
buttan(aaa,bbb+78,8,15);<br />
delay(200);<br />
buttan(aaa,bbb+78,15,8);<br />
screen('1');<br />
mul=0;<br />
continue;<br />
}<br />
<br />
//FOR 2<br />
if(c==1 && a>(aaa+39) && a<(aaa+64) && b>(bbb+78) && b<(bbb+103))<br />
{<br />
buttan(aaa+39,bbb+78,8,15);<br />
delay(200);<br />
buttan(aaa+39,bbb+78,15,8);<br />
screen('2');<br />
mul=0;<br />
continue;<br />
}<br />
<br />
//FOR 3<br />
if(c==1 && a>(aaa+78) && a<(aaa+103) && b>(bbb+78) && b<(bbb+103))<br />
{<br />
buttan(aaa+78,bbb+78,8,15);<br />
delay(200);<br />
buttan(aaa+78,bbb+78,15,8);<br />
screen('3');<br />
mul=0;<br />
continue;<br />
}<br />
<br />
//FOR *<br />
if(c==1 && a>(aaa+117) && a<(aaa+142) && b>(bbb+78) && b<(bbb+103))<br />
{ rep++;<br />
mul++;<br />
if(mul==2)<br />
{ rep--;<br />
mul--;<br />
}<br />
if(rep==2)<br />
goto label;<br />
status=1;<br />
buttan(aaa+117,bbb+78,8,15);<br />
delay(200);<br />
buttan(aaa+117,bbb+78,15,8);<br />
d1=f1;<br />
strcpy(st2,"");<br />
scremt();<br />
continue;<br />
}<br />
<br />
// FOR FORTH ROW XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<br />
// FOR 0<br />
if(c==1 && a>aaa && a<(aaa+25) && b>(bbb+117) && b<(bbb+142))<br />
{<br />
buttan(aaa,bbb+117,8,15);<br />
delay(200);<br />
buttan(aaa,bbb+117,15,8);<br />
screen('0');<br />
mul=0;<br />
continue;<br />
}<br />
<br />
// FOR .<br />
if(c==1 && a>(aaa+39) && a<(aaa+64) && b>(bbb+117) && b<(bbb+142))<br />
{<br />
buttan(aaa+39,bbb+117,8,15);<br />
delay(200);<br />
buttan(aaa+39,bbb+117,15,8);<br />
screen('.');<br />
mul=0;<br />
continue;<br />
}<br />
<br />
// FOR =<br />
if(c==1 && a>(aaa+78) && a<(aaa+103) && b>(bbb+117) && b<(bbb+142))<br />
{<br />
buttan(aaa+78,bbb+117,8,15);<br />
delay(200);<br />
buttan(aaa+78,bbb+117,15,8);<br />
label:<br />
if(status==1)<br />
{ d2=f1;<br />
d3=d1*d2;<br />
}<br />
if(status==2)<br />
{ d2=f1;<br />
d3=d1+d2;<br />
}<br />
if(status==3)<br />
{ d2=f1;<br />
d3=d1-d2;<br />
}<br />
if(status==4)<br />
{ d2=f1;<br />
d3=d1/d2;<br />
}<br />
char temp[50];<br />
int sig = 10;<br />
<br />
gcvt(d3, sig, temp);<br />
strcpy(st2,"");<br />
strcpy(st2,temp);<br />
scremt();<br />
screen(' ');<br />
rep=0;<br />
mul=0;<br />
continue;<br />
}<br />
<br />
// FOR %<br />
if(c==1 && a>(aaa+117) && a<(aaa+142) && b>(bbb+117) && b<(bbb+142))<br />
{ rep++;<br />
mul++;<br />
if(mul==2)<br />
{ rep--;<br />
mul--;<br />
}<br />
if(rep==2)<br />
goto label;<br />
status=4;<br />
buttan(aaa+117,bbb+117,8,15);<br />
delay(200);<br />
buttan(aaa+117,bbb+117,15,8);<br />
d1=f1;<br />
strcpy(st2,"");<br />
scremt();<br />
continue;<br />
}<br />
<br />
}<br />
getch();<br />
closegraph();<br />
}<br />
<br />
void buttan(int x, int y,int ltcolor,int rtcolor)<br />
{<br />
<br />
setcolor(7);<br />
rectangle(x,y,x+25,y+25);<br />
setfillstyle(1,7);<br />
floodfill(x+2,y+2,7);<br />
<br />
setcolor(ltcolor);<br />
int a[]={ x-2,y-2,x+27,y-2,x+25,y,x,y,x,y+25,x-2,y+27,x-2,y-2};<br />
drawpoly(7,a);<br />
setfillstyle(1,ltcolor);<br />
floodfill(x-1,y+5,ltcolor);<br />
<br />
setcolor(rtcolor);<br />
int b[]={x+27,y-2,x+27,y+27,x-2,y+27,x,y+25,x+25,y+25,x+25,y,x+27,y-2 };<br />
drawpoly(7,b);<br />
setfillstyle(1,rtcolor);<br />
floodfill(x+26,y+5,rtcolor);<br />
}<br />
void text()<br />
{ setcolor(4);<br />
outtextxy(aaa+9,bbb+10,"7");<br />
outtextxy(aaa+48,bbb+10,"8");<br />
outtextxy(aaa+87,bbb+10,"9");<br />
outtextxy(aaa+126,bbb+10,"+");<br />
outtextxy(aaa+9,bbb+49,"4");<br />
outtextxy(aaa+48,bbb+49,"5");<br />
outtextxy(aaa+87,bbb+49,"6");<br />
outtextxy(aaa+126,bbb+49,"-");<br />
outtextxy(aaa+9,bbb+88,"1");<br />
outtextxy(aaa+48,bbb+88,"2");<br />
outtextxy(aaa+87,bbb+88,"3");<br />
outtextxy(aaa+126,bbb+88,"*");<br />
outtextxy(aaa+9,bbb+127,"0");<br />
outtextxy(aaa+48,bbb+124,".");<br />
outtextxy(aaa+87,bbb+127,"=");<br />
outtextxy(aaa+126,bbb+127,"%");<br />
outtextxy(243,85,"RESET");<br />
outtextxy(361,85,"EXIT");<br />
settextstyle(7,HORIZ_DIR,1);<br />
outtextxy(aaa+50,bbb+250,"MADE BY: UPINDER SINGH DHAMI");<br />
<br />
settextstyle(0,0,1);<br />
}<br />
void screen(char ch)<br />
{ setcolor(15);<br />
rectangle(aaa-5,bbb-40,aaa+148,bbb-10);<br />
setfillstyle(1,15);<br />
floodfill(aaa,bbb-20,15);<br />
// outtextxy(aaa+140,bbb,"0.");<br />
scremt();<br />
if(ch!='a')<br />
{<br />
setcolor(1);<br />
st1[0]=ch;<br />
st1[1]='\0';<br />
strcat(st2,st1);<br />
}<br />
l2=strlen(st2);<br />
if(l2>19)<br />
{ scremt();<br />
setcolor(BLUE);<br />
outtextxy(250,136," data overflow");<br />
return;<br />
}<br />
f1 = atof(st2);<br />
outtextxy(395-(l2*8),136,st2);<br />
<br />
}<br />
void scremt()<br />
{ setcolor(14);<br />
rectangle(aaa-5,bbb-40,aaa+148,bbb-10);<br />
setfillstyle(1,14);<br />
floodfill(aaa,bbb-20,14);<br />
}<br />
<br />
void buttan1(int x, int y,int ltcolor,int rtcolor)<br />
{<br />
<br />
setcolor(7);<br />
rectangle(x,y,x+50,y+25);<br />
setfillstyle(1,7);<br />
floodfill(x+2,y+2,7);<br />
<br />
setcolor(ltcolor);<br />
int a[]={ x-4,y-4,x+54,y-4,x+50,y,x,y,x,y+25,x-4,y+29,x-4,y-4};<br />
drawpoly(7,a);<br />
setfillstyle(1,ltcolor);<br />
floodfill(x-3,y-3,ltcolor);<br />
<br />
setcolor(rtcolor);<br />
int b[]={x+54,y-4,x+54,y+29,x-4,y+29,x,y+25,x+50,y+25,x+50,y,x+54,y-4};<br />
drawpoly(7,b);<br />
setfillstyle(1,rtcolor);<br />
floodfill(x+52,y+10,rtcolor);<br />
<br />
setcolor(1);<br />
<br />
}Upinder Singh Dhamihttp://www.blogger.com/profile/10526677796017634649noreply@blogger.com0tag:blogger.com,1999:blog-6297953299971051513.post-62262206154791155862009-09-01T18:40:00.001+05:302009-09-01T18:40:11.125+05:30project of hostel management#include<iostream.h><br />
#include<dos.h><br />
#include<graphics.h><br />
#include<conio.h><br />
#include<string.h><br />
#include<stdio.h><br />
#include<math.h><br />
#include<iomanip.h><br />
#include<process.h><br />
#include<fstream.h><br />
void password();<br />
void add();<br />
void display();<br />
void update();<br />
void del();<br />
void search();<br />
void exit();<br />
struct time t;<br />
struct date d;<br />
fstream fin,fout,fio;<br />
void ctd()<br />
{<br />
gettime(&t); gotoxy(45,50);<br />
printf("Current Time :%2d:%02d:%02d.%02d\n",<br />
t.ti_hour,t.ti_min,t.ti_sec,t.ti_hund);<br />
getdate(&d);gotoxy(45,48);<br />
printf("Current Date:%d-%d-%d\n",d.da_day,d.da_mon,d.da_year);<br />
}<br />
class student<br />
{<br />
private:<br />
int stid;<br />
char name[20];<br />
char sex[10];<br />
char course[20];<br />
char trade[20];<br />
int semester;<br />
int fee;<br />
char fpaid[10];<br />
int rn,bc;<br />
char rt[12];<br />
public:<br />
void getnewdata()<br />
{<br />
cout<<"enter new semester";<br />
cin>>semester;<br />
cout<<"enter new room no";<br />
cin>>rn;<br />
}<br />
int putstid()<br />
{<br />
return(stid);<br />
}<br />
void getdata()<br />
{ gotoxy(30,14);<br />
cout<<"ENTER STUDENT ID :";gotoxy(30,16);<br />
cin>>stid;<br />
cout<<"ENTER NAME :";gotoxy(30,18);<br />
cin>>name;<br />
cout<<"ENTER THE ROOM ALLOTED :";gotoxy(30,20);<br />
cin>>rn;<br />
cout<<"ENTER SEX :";gotoxy(30,22);<br />
cin>>sex;<br />
cout<<"ENTER COURSE :";gotoxy(30,24);<br />
cin>>course;<br />
cout<<"ENTER TRADE :";gotoxy(30,26);<br />
cin>>trade;<br />
cout<<"ENTER SEMESTER";gotoxy(30,28);<br />
cin>>semester;<br />
cout<<"ENTER BATCH";gotoxy(30,30);<br />
cin>>bc;<br />
}<br />
void putrt(char* p)<br />
{<br />
strcpy(rt,p);<br />
}<br />
void putdata()<br />
{ gotoxy(30,14);<br />
cout<<"STUDENT ID IS"<<"\t"<<"STUDENTNAME"<<"\t"<<"ROOMALLOTED"<<"\t"<<"SEX"<<"\t"<<"COURSE"<<"\t"<<"TRADE"<<"\t"<<"SEMSETER"<<"\t"<<"BATCH"<<endl;<br />
cout<<name<<"\t"<<rn<<"\t"<<sex<<"\t"<<course<<"\t"<<trade<<"\t"<<semester<<"\t"<<bc<<endl;<br />
}<br />
}s1;<br />
class personal<br />
{<br />
private:<br />
int rollno;<br />
char name[20];<br />
char sex[10];<br />
char bg[20];<br />
char dob[20];<br />
char fn[20];<br />
char mn[20];<br />
char adr[50];<br />
long phn;<br />
int rn;<br />
public:<br />
void getnewaddress()<br />
{<br />
cout<<"ENTER NEW ADDRESS";<br />
cin>>adr;<br />
}<br />
char * getname()<br />
{<br />
return(name);<br />
}<br />
int getrollno()<br />
{<br />
return(rollno);<br />
}<br />
void getdata()<br />
{<br />
gotoxy(25,18);<br />
textcolor(23);<br />
<br />
cout<<" ENTER STUDENT ID :";gotoxy(25,20);<br />
cin>>rollno;<br />
cout<<"ENTER NAME :";gotoxy(25,22);<br />
cin>>name;<br />
cout<<"ENTER SEX :";gotoxy(25,24);<br />
cin>>sex;<br />
cout<<"ENTER BLOOD GROUP :";gotoxy(25,26);<br />
cin>>bg;<br />
cout<<"ENTER DATE OF BIRTH :"; gotoxy(25,28);<br />
cin>>dob;<br />
cout<<"ENTER FATHER NAME :"; gotoxy(25,30);<br />
cin>>fn;<br />
cout<<"ENTER MOTHER NAME :";gotoxy(25,32);<br />
cin>>mn;<br />
cout<<"ENTER THE ADDRESS :";gotoxy(25,34);<br />
cin>>adr;<br />
cout<<"ENTER PHONE NO. :" ;gotoxy(25,36);<br />
cin>>phn;<br />
}<br />
void putdata()<br />
{<br />
cout<<"SID"<<"\t"<<"NAME"<<"\t"<<"SEX"<<"\t"<<"BGROUP"<<"\t"<<"FATHERNAME"<<"\t"<<"MOTHERNAME"<<"\t"<<"ADDRESS"<<"\t"<<"PNO."<<endl;<br />
<br />
cout<<rollno<<"\t "<<name<<"\t"<<sex<<"\t"<<bg<<"\t " <<fn<<"\t "<<mn<<"\t "<<adr<<"\t "<<phn<<"\t "<<rn<<endl;<br />
<br />
}<br />
}p1 ;<br />
class room<br />
{<br />
private:<br />
int rn, fan,tubelight,ac,cooler,tc,bed,cupboard;<br />
char rt[12];<br />
char avail;<br />
public:<br />
int putrn()<br />
{<br />
return(rn);<br />
}<br />
void grn(int p)<br />
{<br />
rn=p;<br />
}<br />
void getrn()<br />
{<br />
cout<<"ENTER NEW ROOM NUMBER :";<br />
cin>>rn;<br />
}<br />
void getdata()<br />
{<br />
gotoxy(25,25);<br />
textcolor(13);<br />
/* cout<<"ENTER ROOM NUMBER : ";cout<<endl;<br />
cin>>rn; */<br />
cout<<"ENTER NUMBER OF FAN AVAILABLE :";cout<<endl;<br />
cin>>fan;<br />
cout<<"ENTER NUMBER OF TUBELIGHT AVAIABLE : ";cout<<endl;<br />
cin>>tubelight;<br />
cout<<"ENTER NUMBER OF AC AVAILABLE : ";cout<<endl;<br />
cin>>ac;<br />
cout<<"ENTER NUMBER OF COOLER AVAILABLE :";cout<<endl;<br />
cin>>cooler;<br />
cout<<"ENTER NUMBER OF CUPBOARD AVAILABLE :";cout<<endl;<br />
cin>>cupboard;<br />
cout<<"ENTER NUMBER OF TABLE CHAIR AVAILABLE :";cout<<endl;<br />
cin>>tc;<br />
cout<<"ENTER THE NUMBER OF BED : ";cout<<endl;<br />
cin>>bed;<br />
cout<<"ENTER NUMBER OF ROOM AVAILABLE :";cout<<endl;<br />
cin>>avail;<br />
cout<<"ENTER ROOM TYPE";cout<<endl;<br />
cout<<"1. SINGLET ROOM :"<<endl;<br />
cout<<"2. DOUBLET ROOM :"<<endl;<br />
cout<<"3. TRIPLET ROOM :"<<endl;<br />
cout<<"PLEASE ENTERED CHOICE :"<<endl;<br />
int choice;<br />
cin>>choice;<br />
if(choice==1)<br />
strcpy(rt,"singlet");<br />
else if(choice==2)<br />
strcpy(rt,"doublet");<br />
else strcpy(rt,"triplet");<br />
}<br />
void putdata()<br />
{<br />
<br />
cout<<"ROOMNO"<<"\t"<<"FAN"<<"\t"<<"TUBE"<<"\t"<<"AC"<<"\t"<<"COOLER"<<"\t"<<"CUPBOARD"<<"\t"<<"TABLE"<<"\t"<<"BED"<<"\t"<<"ROOM"<<endl;<br />
cout<<rn<<"\t "<<fan<<"\t "<<tubelight<<"\t"<<ac<<"\t"<<cooler<<"\t "<<cupboard<<"\t " <<tc<<"\t "<<bed<<"\t "<<avail<<endl;<br />
<br />
}<br />
}r1,r2;<br />
<br />
void main()<br />
{<br />
// password();<br />
int gmode,gdriver=DETECT;<br />
initgraph(&gdriver,&gmode,"l:\tc\bgi");<br />
char ch;<br />
do<br />
{<br />
clrscr();<br />
ctd();<br />
gotoxy(25,14); sound(600);<br />
delay(500);<br />
nosound();<br />
cout<<"======================================"; gotoxy(30,14);<br />
cout<<"*MAIN MENU*"<<setw(20)<<endl;gotoxy(24,16);<br />
cout<<" 1. ADD THE RECORD:"<<endl;gotoxy(25,18);<br />
cout<<" 2. DISPLAY THE RECORD:"<<endl;gotoxy(25,20);<br />
cout<<" 3. SEARCH THE RECORD:"<<endl;gotoxy(25,22);<br />
cout<<" 4. UPDATE RECORD:"<<endl;gotoxy(25,24);<br />
cout<<" 5. DELETE RECORD:"<<endl;gotoxy(25,26);<br />
cout<<" 6. EXIT"<<endl;gotoxy(25,28);<br />
cout<<"PLEASE ENTER THE CHOICE :"; gotoxy(25,30);<br />
<br />
cout<<"=======================================";<br />
<br />
cin>>ch;<br />
switch(ch) //main switch<br />
{<br />
case '1': add();break;<br />
case '2': display();break;<br />
case '3': search();break;<br />
case '4': update();break;<br />
case '5': del(); break;<br />
case '6': exit();<br />
}<br />
}while(ch!='6');<br />
closegraph();<br />
getch();<br />
}<br />
<br />
// end of main function<br />
void password()<br />
{ ctd();<br />
gotoxy(15,20);<br />
textcolor(6);<br />
textbackground(750);<br />
cout<< " *******************************************************"<<endl;gotoxy(15,20);<br />
cout<< " *******************************************************"<<endl;gotoxy(15,21);<br />
cout<< " *******************************************************"<<endl;gotoxy(15,22);<br />
cout<< " ********** PROJECT **********"<<endl;gotoxy(15,23);<br />
cout<< " ********** ON **********"<<endl;gotoxy(15,24);<br />
cout<< " ********** HOSTEL MANAGEMENT **********"<<endl;gotoxy(15,25);<br />
cout<< " ********** **********"<<endl;gotoxy(15,26);<br />
cout<< " ********** MADE BY: **********"<<endl;gotoxy(15,27);<br />
cout<< " ********** VAMA VARUN **********"<<endl;gotoxy(15,28);<br />
cout<< " ********** VISHAL VISHAL **********"<<endl;gotoxy(15,29);<br />
cout<< " *******************************************************"<<endl;gotoxy(15,30);<br />
cout<< " *******************************************************"<<endl;gotoxy(15,31);<br />
cout<< " *******************************************************"<<endl;gotoxy(15,32);<br />
<br />
getch();<br />
// password code<br />
char un[20]="vishal",pw[20]="manish",un1[20],pw1[20];<br />
for(int i=0;i<3;i++) //for loop<br />
{<br />
int j=0;<br />
textcolor(6);<br />
textbackground(700);<br />
clrscr();<br />
ctd();<br />
gotoxy(26,26);<br />
cout<<"PLEASE ENTER USER NAME : ";<br />
gotoxy(50,26);<br />
cin>>un1;<br />
clrscr();<br />
ctd();<br />
gotoxy(26,26);<br />
textcolor(6);<br />
textbackground(700);<br />
cout<<"PLEASE ENTER YOUR PASSWORD >%>%>%>%>%> ";<br />
char ch; j=0;<br />
do<br />
{<br />
ch=getch();<br />
pw1[j]=ch;<br />
if(ch=='\n'||ch=='\t'||ch=='\r')<br />
break;<br />
else<br />
{<br />
cout<<"*";<br />
j++;<br />
}<br />
}while(ch!='\r');<br />
pw1[j]='\0';<br />
gotoxy(25,15);<br />
if(strcmp(un,un1)==0 && strcmp(pw,pw1)==0)<br />
{<br />
clrscr();<br />
ctd(); //right password<br />
gotoxy(30,12);<br />
textcolor(6);<br />
textbackground(700);<br />
cout<<"PASSWORD................IS....CONFERMED";<br />
getch();<br />
clrscr();<br />
gotoxy(30,12);<br />
cout<<" WELCOME ";gotoxy(30,14);<br />
cout<<" TO ";gotoxy(30,16);<br />
cout<<" HOSTEL ";<br />
getch();<br />
break;<br />
}<br />
else<br />
{<br />
if(i==2) //wrong code<br />
exit(0);<br />
} clrscr();<br />
gotoxy(30,14);<br />
<br />
cout<<" WRONG......... PASSWORD.........";<br />
getch();<br />
clrscr();<br />
gotoxy(30,14);<br />
cout<<"TRY AGAIN.......................";<br />
getch();<br />
}<br />
<br />
} //end of password function<br />
<br />
void add()<br />
{<br />
char choice;<br />
<br />
do<br />
{<br />
clrscr();<br />
ctd();<br />
gotoxy(29,14);<br />
cout<<"*ADD RECORD*"<<endl;<br />
gotoxy(25,18);<br />
cout<<"a.ROOM RECORD"<<endl; gotoxy(25,20);<br />
cout<<"b.STUDENT RECORD ::PERSONAL INFORMATION"<<endl; gotoxy(25,22);<br />
cout<<"c.STUDENT RECORD ::STUDENT ID "<<endl; gotoxy(25,24);<br />
cout<<"d.TO EXIT";<br />
cout<<"ENTER CHOICE ";<br />
cin>>choice;<br />
clrscr();<br />
switch(choice)<br />
{<br />
case 'a':<br />
cout<<"STUDENT ID"<<endl;gotoxy(30,14);<br />
char a;<br />
clrscr();<br />
ctd();<br />
gotoxy(25,25);<br />
cout<<" ROOM INFORMATION : "<<endl;gotoxy(25,26);<br />
cout<<"1. SINGLET ROOM :"<<endl;gotoxy(25,27);<br />
cout<<"2. DOUBLET ROOM :"<<endl; gotoxy(25,28);<br />
cout<<"3. TRIPLET ROOM :"<<endl; gotoxy(25,29);<br />
<br />
cout<<"PLEASE ENTERED CHOICE :"<<endl;<br />
cin>>a;<br />
switch(a)<br />
<br />
{<br />
case '1':<br />
<br />
cout<<"*SINGLET ROOM*" <<endl;<br />
cout<<"SINGLET"<<endl;<br />
cout<<"CHARGES ARE AS FOLLOWS:"<<endl;<br />
cout<<"ROOM CHARGES ARE:Rs 1500 PER MONTH (AC)"<<endl;<br />
getch();<br />
break;<br />
case '2':<br />
cout<<" *DOUBLET ROOM*" <<endl;<br />
cout<<"DOUBLET "<<endl;<br />
cout<<"CHARGES ARE AS FOLLOWS:"<<endl;<br />
cout<<"ROOM CHARGES ARE:Rs 1200 PER MONTH (AC)"<<endl;<br />
getch();<br />
break;<br />
case '3':<br />
cout<<" *TRIPLET ROOM*"<<endl;<br />
cout<<"TRIPLET "<<endl;<br />
cout<<"CHARGES ARE AS FOLLOWS:"<<endl;<br />
cout<<"ROOM CHARGES ARE:Rs 1000 PER MONTH (AC)"<<endl;<br />
getch();<br />
break;<br />
default :<br />
{<br />
cout<<" *ENTER APPOPRIATE CHOICE*"<<endl;<br />
cout<<"WRONG CHOICE "<<endl;<br />
getch();<br />
}<br />
}<br />
cout<<"ROOM RECORD :"<<endl; gotoxy(10,11);<br />
int flag=0;<br />
clrscr();<br />
ctd();<br />
cout<<"ENTER ROOM INFORMATION"<<endl;<br />
fio.open("rm.dat",ios::out|ios::in);<br />
fio.seekg(0,ios::beg);<br />
if(!fio)<br />
{<br />
cout<<"FILE CAN'T BE OPENED"<<endl;<br />
getch();<br />
}<br />
else<br />
{<br />
int rn;<br />
cout<<"enter room no";<br />
cin>>rn;<br />
fio.seekg(0,ios::beg);<br />
while(fio.read((char*)&r1,sizeof(r1)))<br />
{<br />
getch();<br />
if(rn==r1.putrn())<br />
{<br />
flag=1;<br />
break;<br />
}<br />
}<br />
fio.clear();<br />
fio.close();<br />
if(flag==1)<br />
{<br />
cout<<"room already exist";<br />
getch();<br />
return;<br />
}<br />
r2.getdata();<br />
r2.grn(rn);<br />
fout.open("rm.dat",ios::out|ios::ate);<br />
cout<<"WANT TO SAVE THE DATA? PRESS Y/N.";<br />
cin>>choice;<br />
if(choice=='y')<br />
{<br />
fout.write( (char *)&r2,sizeof(r2));<br />
fout.clear();<br />
cout<<"record saved";<br />
getch();<br />
}<br />
fout.close();<br />
<br />
}<br />
break;<br />
<br />
<br />
<br />
<br />
case 'c':<br />
cout<<"STUDENT RECORD:STUDENT ID "<<endl; gotoxy(10,11);<br />
int flag1=0;<br />
clrscr();<br />
ctd();<br />
cout<<"ENTER STUDENT ID"<<endl;<br />
fio.open("st.dat",ios::out|ios::in);<br />
fio.seekg(0,ios::beg);<br />
if(!fio)<br />
{<br />
cout<<"FILE CAN'T BE OPENED"<<endl;<br />
getch();<br />
}<br />
else<br />
{<br />
int rn5;<br />
cout<<"enter student id";<br />
cin>>rn5;<br />
fio.seekg(0,ios::beg);<br />
while(fio.read((char*)&s1,sizeof(s1)))<br />
{<br />
getch();<br />
if(rn5==s1.putstid())<br />
{<br />
flag1=1;<br />
break;<br />
}<br />
}<br />
fio.clear();<br />
fio.close();<br />
if(flag1==1)<br />
{<br />
cout<<"id already exist";<br />
getch();<br />
return;<br />
}<br />
s1.getdata();<br />
s1.putstid();<br />
fout.open("st.dat",ios::out|ios::ate);<br />
cout<<"WANT TO SAVE THE DATA? PRESS Y/N.";<br />
cin>>choice;<br />
if(choice=='y')<br />
{<br />
fout.write( (char *)&s1,sizeof(s1));<br />
fout.clear();<br />
cout<<"record saved";<br />
getch();<br />
}<br />
fout.close();<br />
<br />
}<br />
break;<br />
<br />
<br />
/* clrscr();<br />
ctd();<br />
fout.open("pi.dat",ios::app);<br />
if(!fout)<br />
{<br />
cout<<"FILE CAN'T BE OPENED"<<endl;<br />
}<br />
else<br />
{<br />
clrscr();<br />
cout<<"ENTER THE DATA :"<<endl;<br />
p1.getdata();<br />
cout<<"WANT TO BE SAVE THEN PRESS Y:";<br />
cin>>choice;<br />
if(choice=='y')<br />
{<br />
fout.write((char*)&p1,sizeof(p1));<br />
fout.clear();<br />
getch();<br />
}<br />
fout.close();<br />
}<br />
break; */<br />
<br />
<br />
<br />
<br />
case 'b':<br />
cout<<"STUDENT RECORD:PERSONAL INFORMATION "<<endl; gotoxy(10,11);<br />
int flag2=0;<br />
clrscr();<br />
ctd();<br />
cout<<"ENTER PERSONAL INFORMATION"<<endl;<br />
fio.open("pi.dat",ios::out|ios::in);<br />
fio.seekg(0,ios::beg);<br />
if(!fio)<br />
{<br />
cout<<"FILE CAN'T BE OPENED"<<endl;<br />
getch();<br />
}<br />
else<br />
{<br />
char* p;<br />
char name2[15];<br />
cout<<"enter student name";<br />
cin>>name2;<br />
fio.seekg(0,ios::beg);<br />
while(fio.read((char*)&p1,sizeof(p1)))<br />
{<br />
getch();<br />
if(strcmp(name2,p)==0)<br />
{<br />
flag2=1;<br />
break;<br />
}<br />
}<br />
fio.clear();<br />
fio.close();<br />
if(flag2==1)<br />
{<br />
cout<<"name already exist";<br />
getch();<br />
return;<br />
}<br />
p1.getdata();<br />
// p1.get(name2);<br />
fout.open("pi.dat",ios::out|ios::ate);<br />
cout<<"WANT TO SAVE THE DATA? PRESS Y/N.";<br />
cin>>choice;<br />
if(choice=='y')<br />
{<br />
fout.write( (char *)&p1,sizeof(p1));<br />
fout.clear();<br />
cout<<"record saved";<br />
getch();<br />
}<br />
fout.close();<br />
<br />
}<br />
break;<br />
<br />
<br />
/* clrscr();<br />
ctd();<br />
gotoxy(30,14);<br />
cout<<"PERSONAL INFORMATION"<<endl;<br />
fout.open("pi.dat",ios::app);<br />
if(!fout)<br />
{<br />
cout<<"FILE CAN'T BE OPENED"<<endl;<br />
}<br />
else<br />
{<br />
cout<<"ENTER THE DATA :"<<endl;<br />
p1.getdata();<br />
cout<<"want to save then press y";<br />
cin>>choice;<br />
if(choice=='y')<br />
{<br />
fout.write( (char *)&p1,sizeof(p1));<br />
fout.clear();<br />
getch();<br />
}<br />
fout.close();<br />
} */<br />
// main add switch case<br />
<br />
}<br />
}while(choice!='d');<br />
getch();<br />
}<br />
void display()<br />
{ char choice;<br />
do<br />
{ clrscr(); //label for add menu<br />
ctd();<br />
gotoxy(29,14);<br />
cout<<"*DISPLAY RECORD*"<<endl;<br />
gotoxy(25,18);<br />
cout<<"a.ROOM RECORD "<<endl; gotoxy(25,20);<br />
cout<<"b.STUDENT RECORD ::PERSONAL INFORMATION "<<endl; gotoxy(25,22);<br />
cout<<"c.STUDENT RECORD ::STUDENT ID"<<endl;gotoxy(25,24);<br />
cout<<"d.BACK TO MAIN MENU"<<endl;gotoxy(25,26);<br />
cout<<"ENTER CHOICE ";<br />
cin>>choice;<br />
clrscr();<br />
ctd();<br />
switch(choice) // case 2a student record<br />
{<br />
case 'a':cout<<"ROOM RECORD"<<endl; gotoxy(10,11);<br />
cout<<"ROOM INFORMATION"<<endl;<br />
fin.open("rm.dat",ios::in);<br />
fin.seekg(0,ios::beg);<br />
if(!fin)<br />
{<br />
cout<<"FILE CAN'T BE OPENED"<<endl;<br />
getch();<br />
}<br />
else<br />
{<br />
clrscr();<br />
while(fin.read((char *)&r1,sizeof(r1)))<br />
{<br />
r1.putdata();<br />
fin.clear();<br />
getch();<br />
}<br />
fin.close();<br />
}<br />
break;<br />
case 'b':clrscr();<br />
ctd();<br />
gotoxy(30,14);<br />
cout<<"STUDENT RECORD :"<<endl; gotoxy(25,18);<br />
cout<<"PERSONAL INFORMATION"<<endl;<br />
fin.open("pi.dat",ios::in);<br />
if(!fin)<br />
{<br />
cout<<"FILE CAN'T BE OPENED"<<endl;<br />
getch();<br />
}<br />
else<br />
{<br />
while(fin.read((char *)&p1,sizeof(p1)))<br />
{<br />
p1.putdata();<br />
cout<<endl;<br />
fin.clear();<br />
getch();<br />
}<br />
fin.close();<br />
}<br />
break;<br />
<br />
<br />
case 'c': gotoxy(30,14);<br />
cout<<"STUDENT INFORMATION"<<endl;<br />
cout<<"STUDENT ID"<<endl;<br />
fin.open("st.dat",ios::in);<br />
if(!fin)<br />
{<br />
cout<<"FILE CAN'T BE OPENED"<<endl;<br />
}<br />
else<br />
{<br />
while(fin.read((char*)&s1,sizeof(s1)))<br />
{<br />
s1.putdata();<br />
fin.clear();<br />
getch();<br />
}<br />
fin.close();<br />
}<br />
break;<br />
case 'd': cout<<"back to main menu";<br />
getch();<br />
<br />
}<br />
}while(choice!='d');<br />
getch();<br />
}<br />
<br />
<br />
void search()<br />
{<br />
clrscr();<br />
ctd();<br />
char choice;<br />
do<br />
{<br />
clrscr();<br />
ctd();<br />
gotoxy(29,14);<br />
textcolor(25);<br />
textbackground(373);<br />
cout<<"*SEARCH RECORD*"<<endl;<br />
char choice22; gotoxy(25,18);<br />
cout<<"a.STUDENT RECORD BY NAME "<<endl; gotoxy(25,20);<br />
cout<<"b.student id "<<endl; gotoxy(25,22);<br />
cout<<"c.room no "<<endl; gotoxy(25,24);<br />
cout<<"d. back to main menu "<<endl; gotoxy(25,26);<br />
cout<<"ENTER CHOICE ";<br />
cin>>choice;<br />
clrscr();<br />
ctd();<br />
switch(choice)<br />
{<br />
case 'a' : gotoxy(30,14);<br />
cout<<"STUDENT RECORD BY NAME"<<endl;<br />
char *p; char name[15];int flag=0;<br />
cout<<"ENTER STUDENT NAME";<br />
cin>>name;<br />
<br />
fin.open("pi.dat",ios::in);<br />
while(fin.read((char*)&p1,sizeof(p1)))<br />
{<br />
p=p1.getname();<br />
if(strcmp(name,p)==0)<br />
{<br />
p1.putdata();<br />
getch();<br />
flag=1;<br />
}<br />
}<br />
if(flag==0)<br />
{<br />
cout<<"RECORD DOES NOT EXIST";<br />
getch();<br />
}<br />
<br />
fin.close(); //search main switch<br />
break;<br />
case 'b' : gotoxy(30,14);<br />
int roll;<br />
cout<<"STUDENT RECORD BY ID"<<endl;<br />
cout<<"ENTER THE STUDENT ID";<br />
cin>>roll;<br />
flag=0;<br />
fin.open("st.dat",ios::in);<br />
while(fin.read((char*)&s1,sizeof(s1)))<br />
{<br />
if(roll==s1.putstid())<br />
{<br />
s1.putdata();<br />
getch();<br />
flag=1;<br />
}<br />
}<br />
if(flag==0)<br />
<br />
{<br />
cout<<"RECORD DOES NOT EXIST";<br />
getch();<br />
}<br />
<br />
fin.close();<br />
break;<br />
<br />
case 'c': clrscr();<br />
gotoxy(30,16);<br />
cout<<"ROOM INFORMATION "<<endl;<br />
int rn;<br />
flag=0;<br />
cout<<"ENTER ROOM NUMBER ";<br />
cin>>rn;<br />
fin.open("rm.dat",ios::in);<br />
while(fin.read((char*)&r1,sizeof(r1)))<br />
{<br />
if(rn==r1.putrn())<br />
{<br />
r1.putdata();<br />
flag=1;<br />
getch();<br />
}<br />
fin.clear();<br />
}<br />
if(flag==0)<br />
{<br />
cout<<"RECORD DOES NOT EXIST"<<endl;<br />
<br />
getch();<br />
}<br />
<br />
<br />
fin.close();<br />
break;<br />
case 'd': cout<<"BACK TO MAIN MENU";<br />
getch(); }<br />
<br />
} while(choice!='d'); //main serch<br />
<br />
<br />
<br />
getch();<br />
}<br />
<br />
<br />
<br />
<br />
<br />
void update()<br />
{<br />
clrscr();<br />
cout<<"update"<<endl;<br />
char choice;<br />
do<br />
{<br />
clrscr();<br />
gotoxy(29,14);<br />
textcolor(25);<br />
textbackground(373);<br />
cout<<"*UPDATE RECORD*"<<endl;<br />
char choice22; gotoxy(25,18);<br />
cout<<"a.ROOM RECORD"<<endl; gotoxy(25,20);<br />
cout<<"b.STUDENT RECORD:: PERSONAL INFORMATION "<<endl; gotoxy(25,22);<br />
cout<<"c.STUDENT RECORD::STUDENT ID "<<endl; gotoxy(25,24);<br />
cout<<"d. BACK TO MAIN MENU "<<endl; gotoxy(25,26);<br />
cout<<"ENTER CHOICE ";<br />
cin>>choice;<br />
clrscr();<br />
int flag;<br />
switch(choice)<br />
{<br />
case 'a': clrscr();<br />
gotoxy(30,16);<br />
cout<<"ROOM INFORMATION "<<endl;<br />
int rn;<br />
flag=0;<br />
cout<<"ENTER ROOM NO";<br />
cin>>rn;<br />
fin.open("rm.dat",ios::in|ios::out|ios::ate);<br />
fin.seekg(0,ios::beg);<br />
if(!fin)<br />
{<br />
cout<<"FILE CAN NOT OPENED";<br />
getch(); return;<br />
}<br />
else<br />
{<br />
while(fin.read((char*)&r1,sizeof(r1)))<br />
{ cout<<"rn"<<r1.putrn()<<endl;<br />
if(rn==r1.putrn())<br />
{<br />
int p=fin.tellp();<br />
fin.seekp(p-sizeof(r1));<br />
r1.getrn();<br />
fin.write((char*)&r1,sizeof(r1));<br />
fin.clear();<br />
flag=1;<br />
getch();<br />
break;<br />
}<br />
} fin.close();<br />
if(flag==0)<br />
{<br />
cout<<"RECORD DOES NOT EXIST"<<endl;<br />
return;<br />
<br />
}<br />
cout<<"RECORD IS UPDATED"<<endl;<br />
getch();<br />
<br />
}<br />
break;<br />
<br />
case 'b' : gotoxy(30,14);<br />
cout<<"STUDENT RECORD BY NAME"<<endl;<br />
char *p; char name[15];int flag=0;<br />
cout<<"ENTER STUDENT NAME";<br />
cin>>name;<br />
fin.open("pi.dat",ios::in|ios::ate|ios::out);<br />
fin.seekg(0,ios::beg);<br />
while(fin.read((char*)&p1,sizeof(p1)))<br />
{<br />
if(strcmp(name,p1.getname())==0)<br />
{<br />
int p=fin.tellp();<br />
p1.getnewaddress();<br />
fin.seekp(p-sizeof(p1));<br />
fin.write((char*)&p1,sizeof(p1));<br />
fin.clear();<br />
p1.putdata();<br />
getch();<br />
flag=1;<br />
}<br />
}<br />
if(flag==0)<br />
{<br />
cout<<"RECORD DOES NOT EXIST";<br />
getch();<br />
}<br />
<br />
fin.close();<br />
cout<<"RECORD IS UPDATED"<<endl;<br />
getch(); //update main switch<br />
break;<br />
case 'c' : gotoxy(30,14);<br />
int roll;<br />
cout<<"STUDENT RECORD BY STUDENT ID"<<endl;<br />
cout<<"ENTER THE STUDENT ID";<br />
cin>>roll;<br />
flag=0;<br />
fin.open("st.dat",ios::in|ios::ate|ios::out);<br />
fin.seekg(0,ios::beg);<br />
while(fin.read((char*)&s1,sizeof(s1)))<br />
{<br />
if(roll==s1.putstid())<br />
{<br />
int p=fin.tellp();<br />
s1.getnewdata();<br />
fin.seekp(p-sizeof(s1));<br />
fin.write((char*)&s1,sizeof(s1));<br />
fin.clear();<br />
getch();<br />
flag=1;<br />
}<br />
}<br />
if(flag==0)<br />
{<br />
cout<<"RECORD DOES NOT EXIST";<br />
getch();<br />
}<br />
cout<<"RECORD IS UPDATED";<br />
getch();<br />
fin.close();<br />
break;<br />
<br />
case 'd': cout<<"back to main menu";<br />
return;<br />
}<br />
<br />
} while(choice!='d'); //main update.<br />
<br />
<br />
<br />
getch();<br />
}<br />
void del()<br />
<br />
{ clrscr();<br />
cout<<"delete"<<endl;<br />
char choice;<br />
do<br />
{<br />
clrscr();<br />
gotoxy(29,14);<br />
textcolor(25);<br />
textbackground(373);<br />
cout<<"*DELETE RECORD*"<<endl;<br />
char choice22; gotoxy(25,18);<br />
cout<<"a.DELETE THROUGH ROOM NUMBER"<<endl; gotoxy(25,20);<br />
cout<<"b.DELETE THROUGH SYUDENT ID "<<endl; gotoxy(25,22);<br />
cout<<"c.DELETE THROUGH STUDENT NAME "<<endl; gotoxy(25,24);<br />
cout<<"d. BACK TO MAIN MENU "<<endl; gotoxy(25,26);<br />
cout<<"ENTER CHOICE ";<br />
cin>>choice;<br />
clrscr();<br />
int flag;<br />
switch(choice)<br />
{<br />
case 'a': clrscr();<br />
gotoxy(30,16);<br />
cout<<"DELETE THROUGH ROOM NO "<<endl;<br />
int rn;<br />
flag=0;<br />
cout<<"ENTER ROOM NO";<br />
cin>>rn;<br />
fout.open("temp.dat",ios::in|ios::out|ios::app);<br />
fout.seekg(0, ios::beg);<br />
fin.open("rm.dat",ios::in|ios::out|ios::app);<br />
fin.seekg(0, ios::beg);<br />
while(fin.read((char*)&r1,sizeof(r1)))<br />
{<br />
if(rn==r1.putrn())<br />
{<br />
cout<<"RECORD DELETED";<br />
getch();<br />
flag=1;<br />
}<br />
else<br />
{ fout.write((char*)&r1,sizeof(r1));<br />
fout.clear();<br />
fin.clear();<br />
}<br />
}<br />
fin.close();<br />
fout.close();<br />
if(flag==0)<br />
{<br />
cout<<"RECORD NOT FOUND";<br />
getch();<br />
}<br />
remove("rm.dat");<br />
rename("temp.dat","rm.dat");<br />
break;<br />
case 'b':<br />
clrscr();<br />
gotoxy(30,16);<br />
cout<<"DELETE THROUGH STUDENT ID "<<endl;<br />
int rn1;<br />
flag=0;<br />
cout<<"ENTER STUDENT ID";<br />
cin>>rn1;<br />
fout.open("temp.dat",ios::in|ios::out|ios::app);<br />
fout.seekg(0, ios::beg);<br />
fin.open("st.dat",ios::in|ios::out|ios::app);<br />
fin.seekg(0, ios::beg);<br />
while(fin.read((char*)&s1,sizeof(s1)))<br />
{<br />
if(rn1==s1.putstid())<br />
{<br />
cout<<"RECORD DELETED";<br />
getch();<br />
flag=1;<br />
}<br />
else<br />
{ fout.write((char*)&s1,sizeof(s1));<br />
fout.clear();<br />
fin.clear();<br />
}<br />
}<br />
fin.close();<br />
fout.close();<br />
if(flag==0)<br />
{<br />
cout<<"RECORD NOT FOUND";<br />
getch();<br />
}<br />
remove("st.dat");<br />
rename("temp.dat","st.dat");<br />
break;<br />
<br />
case 'c':<br />
clrscr();<br />
gotoxy(30,16);<br />
cout<<"DELETE THROUGH STUDENT NAME"<<endl;<br />
char name[15];<br />
char* p;<br />
flag=0;<br />
cout<<"ENTER STUDENT NAME";<br />
cin>>name;<br />
fout.open("temp.dat",ios::in|ios::out|ios::app);<br />
fout.seekg(0, ios::beg);<br />
fin.open("pi.dat",ios::in|ios::out|ios::app);<br />
fin.seekg(0, ios::beg);<br />
while(fin.read((char*)&p1,sizeof(p1)))<br />
{<br />
p=p1.getname();<br />
if(strcmp(name,p)==0)<br />
{<br />
cout<<"RECORD DELETED";<br />
getch();<br />
flag=1;<br />
}<br />
else<br />
{ fout.write((char*)&s1,sizeof(s1));<br />
fout.clear();<br />
fin.clear();<br />
}<br />
}<br />
fin.close();<br />
fout.close();<br />
if(flag==0)<br />
{<br />
cout<<"RECORD NOT FOUND";<br />
getch();<br />
}<br />
remove("pi.dat");<br />
rename("temp.dat","pi.dat");<br />
break;<br />
case 'd':<br />
cout<<"BACK TO MAIN MENU";<br />
getch();<br />
return;<br />
<br />
}}while(choice!='d');<br />
<br />
<br />
<br />
<br />
<br />
getch();<br />
}<br />
void exit()<br />
{<br />
clrscr();<br />
gotoxy(35,25);<br />
cout<<"BYE BYE";<br />
getch();<br />
exit(1);<br />
}Upinder Singh Dhamihttp://www.blogger.com/profile/10526677796017634649noreply@blogger.com0tag:blogger.com,1999:blog-6297953299971051513.post-18525044013591405402009-09-01T18:38:00.001+05:302009-09-01T18:38:51.966+05:30project of banking#include<iostream.h><br />
#include<fstream.h><br />
#include<conio.h><br />
#include<string.h><br />
#include<stdio.h><br />
#include<stdlib.h><br />
#include<iomanip.h><br />
#include <dos.h><br />
#include <stdio.h><br />
<br />
static int transactioncode;<br />
static int accountnumber;<br />
int sm,tempo1,tempo;<br />
struct inter<br />
{<br />
int accno;<br />
float interest;<br />
long balance;<br />
};<br />
<br />
struct joint<br />
{<br />
public:<br />
int accno;<br />
char namej[100];<br />
char fatherj[100];<br />
char dobj[100];<br />
char addressj[100];<br />
char phonj[100];<br />
public:<br />
void jointin()<br />
{<br />
cout<<"\n give personal detail of joint partner";<br />
cout<<"\n name of partner is:"; gets(namej);<br />
cout<<"\n father name:";gets(fatherj);<br />
cout<<"\n date of birth:";gets(dobj);<br />
cout<<"\n address is:"; gets(addressj);<br />
cout<<"\n phone no. :"; gets(phonj);<br />
<br />
}<br />
void jointout()<br />
{<br />
cout<<"\n personal detail of joint partner";<br />
cout<<"\n name of partner is:"; puts(namej);<br />
cout<<"\n father name:";puts(fatherj);<br />
cout<<"\n date of birth:";puts(dobj);<br />
cout<<"\n address is:"; puts(addressj);<br />
cout<<"\n phone no. :"; puts(phonj);<br />
}<br />
};<br />
<br />
struct node1<br />
{<br />
joint info;<br />
node1 *link;<br />
};<br />
<br />
struct mem<br />
{<br />
int ac_no;<br />
char name[100];<br />
int dayb;<br />
int monthb;<br />
int yearb;<br />
char father[100];<br />
char address[100];<br />
char ph_no[100];<br />
joint d;<br />
int j;<br />
long balance;<br />
int day;<br />
int month;<br />
int year;<br />
char status[100];<br />
char type[100];<br />
<br />
fstream oo;<br />
<br />
public:<br />
void get();<br />
void show();<br />
};<br />
<br />
void mem::get()<br />
{<br />
cout<<"\nEnter acc No : ";<br />
ac_no=accountnumber;<br />
accountnumber++;<br />
cout<<ac_no;<br />
cout<<"\nEnter Name : ";<br />
gets(name);<br />
<br />
while(1)<br />
{<br />
cout<<"\n Enter dob : "<<"format is day\nmonth\nyear\n ";<br />
cout<<"\n holder must be of 10 year old or more in age:";<br />
cin>>dayb;<br />
cin>>monthb;<br />
cin>>yearb;<br />
<br />
if(yearb<1900 || yearb>1995)<br />
{<br />
cout<<"\n invalid date";<br />
continue;<br />
}<br />
if(monthb<1 || monthb>12)<br />
{<br />
cout<<"\n invalid date";<br />
continue;<br />
}<br />
if(dayb>31)<br />
{<br />
cout<<"\n invalid date:";<br />
continue;<br />
<br />
}<br />
<br />
if(monthb==2)<br />
{<br />
if(dayb>28)<br />
{<br />
cout<<"invalid date";<br />
continue;<br />
}<br />
}<br />
if(monthb==4||monthb==6||monthb==9||monthb==11)<br />
{<br />
if(dayb==31)<br />
{<br />
cout<<"\n invalid date";<br />
continue;<br />
}<br />
}<br />
<br />
break;<br />
<br />
}<br />
cout<<"\nEnter fathername : ";gets(father);<br />
cout<<"\nenter adedress:";<br />
gets(address);<br />
cout<<"\nphone no";<br />
gets(ph_no);<br />
//if(strlen(ph_no)=10 &&ph_no[1]==0 ||ph_no[1]==9)<br />
//{<br />
//cout<<" correct np:";<br />
//break;<br />
//}<br />
//else<br />
//cout<<"enter correct no";<br />
<br />
//}<br />
<br />
while(1)<br />
{<br />
cout<<"\nEnter balance: ";<br />
cin>>balance;<br />
if(balance>1000)<br />
{<br />
cout<<"\nsufficient credit limit:";<br />
break;<br />
}<br />
cout<<"\nlow";<br />
}<br />
<br />
while(1)<br />
{<br />
cout<<"\n Enter doc : "<<"format is day\nmonth\nyear\n ";<br />
<br />
cin>>day;<br />
cin>>month;<br />
cin>>year;<br />
<br />
if(year<1990 || year>2005)<br />
{<br />
cout<<"\n invalid date";<br />
continue;<br />
}<br />
if(month<1 || month>12)<br />
{<br />
cout<<"\n invalid date";<br />
continue;<br />
}<br />
if(day>31)<br />
{<br />
cout<<"\n invalid date:";<br />
continue;<br />
<br />
}<br />
<br />
if(month==2)<br />
{<br />
if(day>28)<br />
{<br />
cout<<"invalid date";<br />
continue;<br />
}<br />
}<br />
if(month==4||month==6||month==9||month==11)<br />
{<br />
if(day==31)<br />
{<br />
cout<<"\n invalid date";<br />
continue;<br />
}<br />
}<br />
<br />
break;<br />
<br />
}<br />
while(1)<br />
{<br />
cout<<"\nEnter status : ";<br />
cout<<"\n for ACTIVE put [ a ] fOR INACTIVE put [ i ] ";<br />
gets(status);<br />
if(strcmp(status,"a")==0)<br />
{<br />
cout<<"\naccount is running:";<br />
break;<br />
}<br />
}<br />
cout<<"enter type:";<br />
cout<<"\n for single put [ s ] and for joint put [ j ]";<br />
gets(type);<br />
if(strcmp(type,"j")==0)<br />
{<br />
cout<<"\n how many joint members:";<br />
cin>>j;<br />
<br />
oo.open("d:\\turboc3\\joint.bin",ios::app|ios::out|ios::binary);<br />
<br />
for(int i=0;i<j;i++) //problem 1<br />
{<br />
d.accno=ac_no;<br />
d.jointin();<br />
oo.write((char*)&d,sizeof(d));<br />
}<br />
<br />
oo.close();<br />
}else<br />
j=0;<br />
<br />
}<br />
<br />
void mem::show()<br />
{<br />
cout<<"\n**************************************";<br />
cout<<"\nacc no is:"; cout<<ac_no;<br />
cout<<"\nname is"; puts(name);<br />
cout<<"\ndob:"; cout<<dayb<<"/"<<monthb<<"/"<<yearb;<br />
cout<<"\nfather"; puts(father);<br />
cout<<"\naddress:"; puts(address);<br />
cout<<"\nph no is:"; puts(ph_no);<br />
cout<<"\nbalance is"; cout<<balance;<br />
cout<<"\ndoc:"; cout<<day<<"/"<<month<<"/"<<year;<br />
cout<<"\nstatus"; puts(status);<br />
cout<<"\ntype:"; puts(type);<br />
<br />
if(strcmp(type,"j")==0)<br />
{<br />
oo.open("d:\\turboc3\\joint.bin",ios::binary|ios::in);<br />
while(1)<br />
{<br />
oo.read((char*)&d,sizeof(d));<br />
if(oo.eof())<br />
break;<br />
<br />
if(d.accno==ac_no)<br />
d.jointout();<br />
}<br />
oo.close();<br />
}<br />
cout<<"\n*********************************";<br />
}<br />
<br />
<br />
struct node<br />
{<br />
mem info;<br />
node* link;<br />
};<br />
<br />
int trc;<br />
<br />
class records<br />
{<br />
mem s;<br />
joint d;<br />
int x,y,z,l,l1;<br />
node *start;<br />
node1 *start1;<br />
public:<br />
records()<br />
{<br />
<br />
start=NULL;<br />
start1=NULL;<br />
}<br />
<br />
void add()<br />
{ fstream f;<br />
f.open("d:\\turboc3\\prob1.bin",ios::out|ios::app|ios::binary);<br />
s.get();<br />
f.write((char*)&s,sizeof(s));<br />
f.close();<br />
}<br />
void showall()<br />
{<br />
fstream f,f1;<br />
f.open("d:\\turboc3\\prob1.bin",ios::in|ios::binary);<br />
f1.open("d:\\turboc3\\joint.bin",ios::in|ios::binary);<br />
if(f.fail())<br />
{<br />
cout<<"File not found"<<endl;<br />
f.close();<br />
f1.close();<br />
return;<br />
}<br />
if(f1.fail())<br />
{<br />
cout<<"File not found"<<endl;<br />
f1.close();<br />
//f.close(); //////////////////////////iuluil<br />
//return;<br />
}<br />
while(1)<br />
{<br />
f.read((char*)&s,sizeof(s));<br />
f1.read((char*)&d,sizeof(d));<br />
if(f.eof())<br />
break;<br />
s.show();<br />
}<br />
f1.close();<br />
f.close();<br />
}<br />
void addtolist()<br />
{<br />
fstream f;<br />
start=NULL;<br />
f.open("d:\\turboc3\\prob1.bin",ios::in|ios::binary);<br />
<br />
while(!f.eof())<br />
{<br />
f.read((char*)&s,sizeof(s));<br />
if(f.eof())<br />
break;<br />
node *p1=new node;<br />
node *m1;<br />
p1->info.ac_no=s.ac_no;<br />
strcpy(p1->info.name,s.name);<br />
p1->info.dayb=s.dayb;<br />
p1->info.monthb=s.monthb;<br />
p1->info.yearb=s.yearb;<br />
strcpy(p1->info.father,s.father);<br />
strcpy(p1->info.address,s.address);<br />
strcpy(p1->info.ph_no,s.ph_no);<br />
p1->info.balance=s.balance;<br />
p1->info.day=s.day;<br />
p1->info.month=s.month;<br />
p1->info.year=s.year;<br />
<br />
strcpy(p1->info.status,s.status);<br />
strcpy(p1->info.type,s.type);<br />
p1->link=NULL;<br />
m1=start;<br />
if(m1==NULL)<br />
start=p1;<br />
else<br />
if(m1->link==NULL)<br />
m1->link=p1;<br />
else<br />
{<br />
while(m1->link!=NULL)<br />
m1=m1->link;<br />
m1->link=p1;<br />
}<br />
<br />
}<br />
f.close();<br />
}<br />
void addtofile()<br />
{ fstream f;<br />
node *k;<br />
k=start;<br />
f.open("d:\\turboc3\\prob1.bin",ios::out|ios::binary);<br />
while(k!=NULL)<br />
{<br />
s.ac_no=k->info.ac_no;<br />
strcpy(s.name,k->info.name);<br />
s.dayb=k->info.dayb;<br />
s.monthb=k->info.monthb;<br />
s.yearb=k->info.yearb;<br />
strcpy(s.father,k->info.father);<br />
strcpy(s.address,k->info.address);<br />
strcpy(s.ph_no,k->info.ph_no);<br />
s.balance=k->info.balance;<br />
strcpy(s.status,k->info.status);<br />
s.day=k->info.day;<br />
s.month=k->info.month;<br />
s.year=k->info.year;<br />
strcpy(s.type,k->info.type);<br />
<br />
f.write((char*)&s,sizeof(s));<br />
k=k->link;<br />
}<br />
f.close();<br />
}<br />
<br />
void modifyrec()<br />
{<br />
char tempn[20];<br />
int tempday,tempmonth,tempyear;<br />
char tempf[20];<br />
char tempadd[20];<br />
char tempph[20];<br />
int x,y;<br />
<br />
node *p2;<br />
addtolist();<br />
<br />
p2=start;<br />
cout<<endl<<"Enter the account no to be modified = ";<br />
int accc;<br />
cin>>accc;<br />
char temp1[100];<br />
while(p2!=NULL)<br />
{<br />
if(accc==p2->info.ac_no)// && p2->info.status=="a")<br />
{<br />
cout<<"Enter New Name = ";<br />
cin>>tempn;<br />
strcpy(p2->info.name,tempn);<br />
while(1)<br />
{<br />
cout<<"\n Enter new dob : "<<"format is day\nmonth\nyear\n ";<br />
cout<<"\n holder must be of 10 year old or more in age:";<br />
cin>>tempday;<br />
cin>>tempmonth;<br />
cin>>tempyear;<br />
<br />
<br />
if(tempyear<1900 || tempyear>1995)<br />
{<br />
cout<<"\n invalid date";<br />
continue;<br />
}<br />
if(tempmonth<1 || tempmonth>12)<br />
{<br />
cout<<"\n invalid date";<br />
continue;<br />
}<br />
if(tempday>31)<br />
{<br />
cout<<"\n invalid date:";<br />
continue;<br />
<br />
}<br />
<br />
if(tempmonth==2)<br />
{<br />
if(tempday>28)<br />
{<br />
cout<<"invalid date";<br />
continue;<br />
}<br />
}<br />
if(tempmonth==4||tempmonth==6||tempmonth==9||tempmonth==11)<br />
{<br />
if(tempday==31)<br />
{<br />
cout<<"\n invalid date";<br />
continue;<br />
}<br />
}<br />
<br />
break;<br />
<br />
}<br />
p2->info.dayb=tempday;<br />
p2->info.monthb=tempmonth;<br />
p2->info.monthb=tempyear;<br />
<br />
cout<<"Enter New father Name = ";<br />
cin>>tempf;<br />
strcpy(p2->info.father,tempf);<br />
<br />
cout<<"Enter New address= ";<br />
cin>>tempadd;<br />
strcpy(p2->info.address,tempadd);<br />
cout<<"Enter New phone no = ";<br />
cin>>tempph;<br />
strcpy(p2->info.ph_no,tempph);<br />
}<br />
p2=p2->link;<br />
} //else kithe lana hai<br />
addtofile();<br />
}<br />
<br />
<br />
void change()<br />
{<br />
char temps[20];<br />
int x,y;<br />
<br />
node *p2;<br />
addtolist();<br />
<br />
p2=start;<br />
cout<<endl<<"Enter the account no whosew status is to be changed = ";<br />
int accc;<br />
cin>>accc;<br />
char temp1[100];<br />
while(p2!=NULL)<br />
{<br />
if(accc==p2->info.ac_no )<br />
{<br />
cout<<"enter i to deactivate and a to activate ";<br />
<br />
<br />
cin>>temps;<br />
strcpy(p2->info.status,temps);<br />
}<br />
p2=p2->link;<br />
}<br />
addtofile();<br />
}<br />
<br />
//cout<<"*****************************************";<br />
<br />
void addjointtolist()<br />
{ fstream f1;<br />
start1=NULL;<br />
<br />
f1.open("d:\\turboc3\\joint.bin",ios::in|ios::binary);<br />
<br />
while(1)<br />
{<br />
f1.read((char*)&d,sizeof(d));<br />
if(f1.eof())<br />
break;<br />
node1 *p2=new node1;<br />
node1 *m1;<br />
<br />
p2->info.accno=d.accno;<br />
strcpy(p2->info.namej,d.namej);<br />
strcpy(p2->info.dobj,d.dobj);<br />
strcpy(p2->info.fatherj,d.fatherj);<br />
strcpy(p2->info.addressj,d.addressj);<br />
strcpy(p2->info.phonj,d.phonj);<br />
p2->link=NULL;<br />
m1=start1;<br />
if(m1==NULL)<br />
start1=p2;<br />
else<br />
if(m1->link==NULL)<br />
m1->link=p2;<br />
else<br />
{<br />
while(m1->link!=NULL)<br />
m1=m1->link;<br />
m1->link=p2;<br />
}<br />
}<br />
f1.close();<br />
}<br />
<br />
void addjointtofile()<br />
{<br />
fstream f1;<br />
node1 *k;<br />
k=start1;<br />
<br />
f1.open("d:\\turboc3\\joint.bin",ios::out|ios::binary);<br />
while(k!=NULL)<br />
{<br />
d.accno=k->info.accno;<br />
strcpy(d.namej,k->info.namej);<br />
strcpy(d.dobj,k->info.dobj);<br />
strcpy(d.fatherj,k->info.fatherj);<br />
strcpy(d.addressj,k->info.addressj);<br />
strcpy(d.phonj,k->info.phonj);<br />
f1.write((char*)&d,sizeof(d));<br />
k=k->link;<br />
}<br />
f1.close();<br />
}<br />
<br />
<br />
void modifyjointrec()<br />
{<br />
//char temp1[20];<br />
char tempnj[20];<br />
char tempdj[20];<br />
char tempfj[20];<br />
char tempaddj[20];<br />
char tempphj[20];<br />
int x,y;<br />
node1 *p3;<br />
addjointtolist();<br />
<br />
p3=start1;<br />
cout<<endl<<"Enter the account no whose joint mem is to be modified = ";<br />
int accc;<br />
cin>>accc;<br />
char temp1[100];<br />
cout<<"\n enter name of joint mem whose record is to b modified";<br />
gets(temp1);<br />
while(p3!=NULL)<br />
{<br />
if(strcmp(temp1,p3->info.namej)==0 && accc==p3->info.accno )<br />
{ cout<<"Enter New Name = ";<br />
<br />
<br />
cin>>tempnj;<br />
strcpy(p3->info.namej,tempnj);<br />
<br />
cout<<"Enter New dob= ";<br />
cin>>tempdj;<br />
strcpy(p3->info.dobj,tempdj);<br />
<br />
cout<<"Enter New father Name = ";<br />
cin>>tempfj;<br />
strcpy(p3->info.fatherj,tempfj);<br />
<br />
cout<<"Enter New address= ";<br />
cin>>tempaddj;<br />
strcpy(p3->info.addressj,tempaddj);<br />
cout<<"Enter New phone no = ";<br />
cin>>tempphj;<br />
<br />
strcpy(p3->info.phonj,tempphj);<br />
}<br />
p3=p3->link;<br />
<br />
}<br />
addjointtofile();<br />
}<br />
//33333333333333333333333333333333333333<br />
<br />
void searcha()<br />
{<br />
int temp;<br />
int x,y,count=0;<br />
cout<<"enter account no.";<br />
cin>>temp;<br />
node *p2;<br />
node *save,*ptr;<br />
node1 *ptr1;<br />
addtolist();<br />
addjointtolist();<br />
int i=0;<br />
ptr=new node;<br />
ptr1=new node1;<br />
ptr=start;<br />
ptr1=start1;<br />
<br />
while(ptr!=NULL)<br />
{<br />
// cout<<"acno="<<ptr->info.ac_no<<" "<<temp<<endl;<br />
if( ptr->info.ac_no==temp)<br />
{<br />
cout<<"acc found"<<endl;<br />
i=1;<br />
<br />
cout<<"\n account found";<br />
cout<<"\n name is :";<br />
<br />
cout<<ptr->info.name;<br />
cout<<"\n dob is :";<br />
<br />
// cout<<ptr->info.dob;<br />
cout<<"\n father name is";<br />
cout<<ptr->info.father;<br />
cout<<"\n address is :";<br />
cout<<ptr->info.address;<br />
cout<<"\n phone no is :";<br />
cout<<ptr->info.ph_no;<br />
<br />
cout<<"\n balance is :";<br />
cout<<ptr->info.balance;<br />
<br />
ptr1=start1;<br />
cout<<"\n type="<<ptr->info.type<<endl;<br />
if(strcmp(ptr->info.type,"j")==0)<br />
{<br />
while(ptr1!=NULL)<br />
{<br />
if(ptr1->info.accno==temp)<br />
{<br />
cout<<"\n joint mem";<br />
cout<<"\n name of joint mem is:";<br />
cout<<ptr1->info.namej;<br />
cout<<"\n dob of joint mem is";<br />
cout<<ptr1->info.dobj;<br />
<br />
cout<<"\n address of joint mem is"; //prob1;<br />
cout<<ptr1->info.addressj;<br />
cout<<"\n phone of joint mem is";<br />
cout<<ptr1->info.phonj;<br />
}<br />
ptr1=ptr1->link;<br />
}<br />
}<br />
<br />
}<br />
ptr=ptr->link;<br />
count++;<br />
}<br />
if(i==0)<br />
{<br />
cout<<"No member corressponding to this Account no. exists";<br />
getch();<br />
return;<br />
}<br />
}<br />
};<br />
<br />
struct trans<br />
{<br />
mem s;<br />
char type[10];<br />
int acc;<br />
int tracode;<br />
int dayt;<br />
int montht;<br />
int yeart;<br />
int amount;<br />
char mode[100];<br />
long bal;<br />
char cheqno[20]; char ddno[20];<br />
char docheq[20]; char dodd[20];<br />
char bank[20];<br />
char branch[20];<br />
<br />
public:<br />
void gettra();<br />
void gettra2();<br />
void showtra();<br />
fstream x;<br />
};<br />
<br />
void trans::gettra()<br />
{<br />
<br />
cout<<"Enter acc No : "; cin>>acc;<br />
//if(acc==s.ac_no) //<br />
//{ //<br />
cout<<"Enter tracode: ";<br />
tracode= transactioncode;<br />
transactioncode++;<br />
cout<<tracode;<br />
/* if(acc==s.ac_no);<br />
{<br />
cout<<"\n balance is ";<br />
bal=s.balance;<br />
cout<<bal;<br />
}*/<br />
// cout<<"Enter dot : ";gets(dot);<br />
/* struct date d;<br />
<br />
getdate(&d);<br />
<br />
yeart=d.da_year;<br />
dayt=d.da_day;<br />
montht=d.da_mon;<br />
cout<<"current date is "<<dayt<<"/"<<montht<<"/"<<yeart<<endl;<br />
*/<br />
while(1)<br />
{<br />
cout<<"\n Enter doc : "<<"format is day/month/year ";<br />
<br />
cin>>dayt;<br />
cin>>montht;<br />
cin>>yeart;<br />
if(yeart<1990||yeart>2006)<br />
{<br />
cout<<"\n invalid date";<br />
continue;<br />
}<br />
if(montht<1||montht>12)<br />
{<br />
cout<<"\n invalid date";<br />
continue;<br />
}<br />
if(dayt>31)<br />
{<br />
cout<<"\n invalid date:";<br />
continue;<br />
<br />
}<br />
<br />
if(montht==2)<br />
{<br />
if(dayt>28)<br />
{<br />
cout<<"invalid date";<br />
continue;<br />
}<br />
}<br />
if(montht==4||montht==6||montht==9||montht==11)<br />
{<br />
if(dayt==31)<br />
{<br />
cout<<"\n invalid date";<br />
continue;<br />
}<br />
<br />
}<br />
<br />
break;<br />
<br />
<br />
}<br />
cout<<"Enter amount: ";cin>>amount;<br />
cout<<"enter mode:";<br />
gets(mode);<br />
if(strcmp(mode,"cheq")==0)<br />
{<br />
<br />
cout<<"transfer by cheq:";<br />
cout<<"\n enter cheque no";gets(cheqno);<br />
cout<<"\n enter date of cheque"; gets(docheq);<br />
cout<<"\n enter bank name"; gets(bank);<br />
cout<<"\n enter branch"; gets(branch);<br />
}<br />
<br />
/* if(strcmp(mode,"dd")==0)<br />
{<br />
cout<<"\n transfer by demand draft:";<br />
cout<<"\n enter demand draft no:";gets(ddno);<br />
cout<<"\n enter demand draft date";gets(dodd);<br />
}*/<br />
<br />
if(strcmp(mode,"translip")==0)<br />
{<br />
cout<<"transfer by transfer slip:";<br />
<br />
}<br />
if(strcmp(mode,"atm")==0)<br />
{<br />
cout<<"transfer by atm:";<br />
}<br />
<br />
<br />
}<br />
//else //<br />
//{ //<br />
//cout<<"invalid account no";<br />
//<br />
//} //<br />
//}//<br />
<br />
<br />
void trans::gettra2()<br />
{<br />
<br />
cout<<"Enter acc No : "; cin>>acc;<br />
cout<<"Enter tracode: ";<br />
tracode= transactioncode;<br />
transactioncode++;<br />
cout<<tracode;<br />
/* struct date d;<br />
<br />
getdate(&d);<br />
<br />
yeart=d.da_year;<br />
dayt=d.da_day;<br />
montht=d.da_mon;<br />
cout<<"current date is "<<dayt<<"/"<<montht<<"/"<<yeart<<endl;<br />
*/<br />
while(1)<br />
{<br />
cout<<"\n Enter dot : "<<"format is day/month/year ";///////////new func<br />
cin>>dayt;<br />
cin>>montht;<br />
cin>>yeart;<br />
if(yeart<1990||yeart>2006)<br />
{<br />
cout<<"\n invalid date";<br />
continue;<br />
}<br />
if(montht<1||montht>12)<br />
{<br />
cout<<"\n invalid date";<br />
continue;<br />
}<br />
if(dayt>31)<br />
{<br />
cout<<"\n invalid date:";<br />
continue;<br />
<br />
}<br />
<br />
if(montht==2)<br />
{<br />
if(dayt>28)<br />
{<br />
cout<<"invalid date";<br />
continue;<br />
}<br />
}<br />
if(montht==4||montht==6||montht==9||montht==11)<br />
{<br />
if(dayt==31)<br />
{<br />
cout<<"\n invalid date";<br />
continue;<br />
}<br />
<br />
}<br />
<br />
break;<br />
<br />
<br />
}<br />
cout<<"Enter amount: ";cin>>amount;<br />
cout<<"enter mode:";<br />
cout<<"/n for cheque-------------cheq";<br />
cout<<"\n for demand draft-------dd";<br />
cout<<"\n for cash---------------cash";<br />
gets(mode);<br />
if(strcmp(mode,"cheq")==0)<br />
{<br />
cout<<"transfer by cheq:";<br />
cout<<"\n enter cheque no";gets(cheqno);<br />
cout<<"\n enter date of cheque"; gets(docheq);<br />
cout<<"\n enter bank name"; gets(bank);<br />
cout<<"\n enter branch"; gets(branch);<br />
}<br />
<br />
if(strcmp(mode,"dd")==0)<br />
{<br />
cout<<"\n transfer by demand draft:";<br />
cout<<"\n enter demand draft no:";gets(ddno);<br />
cout<<"\n enter demand draft date";gets(dodd);<br />
}<br />
<br />
if(strcmp(mode,"cash")==0)<br />
{<br />
cout<<"deposite by cash:";<br />
}<br />
}<br />
<br />
void trans::showtra()<br />
{<br />
cout<<"\nType"<<type;<br />
cout<<"\nacc no is:";cout<<acc;<br />
if(acc==s.ac_no)<br />
{<br />
cout<<"\ntracode is"; cout<<tracode;<br />
cout<<"dot";<br />
cout<<dayt<<"/"<<montht<<"/"<<yeart;<br />
<br />
cout<<"\namount"; cout<<amount;<br />
cout<<"\nmode:"; puts(mode);<br />
cout<<"\nbalance"<<bal;<br />
<br />
if(strcmp(mode,"cheq")==0)<br />
{<br />
cout<<"\ntransfer by cheq:";<br />
cout<<"\n cheque no";puts(cheqno);<br />
cout<<"\n date of cheque"; puts(docheq);<br />
cout<<"\n bank name"; puts(bank);<br />
cout<<"\n branch"; puts(branch);<br />
<br />
<br />
}<br />
<br />
if(strcmp(mode,"dd")==0)<br />
{<br />
cout<<"transfer by demand draft:";<br />
cout<<"\n demand draft no:";puts(ddno);<br />
cout<<"\n demand draft date";puts(dodd);<br />
}<br />
}<br />
}<br />
struct node2<br />
{<br />
trans info;<br />
node2 *link;<br />
};<br />
<br />
class transaction<br />
{<br />
trans t;<br />
mem s;<br />
long bal;<br />
<br />
int rec;<br />
//node2 *start2;<br />
node *start;<br />
node2 *start2;<br />
public:<br />
transaction()<br />
{<br />
start=NULL;<br />
start2=NULL;<br />
<br />
}<br />
<br />
/*void withdraw()<br />
{<br />
fstream f2,f;<br />
f2.open("d:\\turboc3\\tra.bin",ios::out|ios::app|ios::binary);<br />
// t.gettra();<br />
<br />
strcpy(t.type,"Withdraw");<br />
<br />
int x,y;<br />
node *p2;<br />
start=NULL;<br />
f.open("d:\\turboc3\\prob1.bin",ios::in|ios::binary);<br />
while(!f.eof())<br />
{<br />
f.read((char*)&s,sizeof(s));<br />
if(f.eof())<br />
break;<br />
node *p1=new node;<br />
node *m1;<br />
p1->info.ac_no=s.ac_no;<br />
// strcpy(p1->info.name,s.name);<br />
// strcpy(p1->info.dob,s.dob);<br />
strcpy(p1->info.father,s.father);<br />
strcpy(p1->info.address,s.address);<br />
strcpy(p1->info.ph_no,s.ph_no);<br />
p1->info.j=s.j;<br />
p1->info.balance=s.balance;<br />
strcpy(p1->info.type,s.type);<br />
strcpy(p1->info.status,s.status);<br />
// strcpy(p1->info.doc,s.doc);<br />
p1->link=NULL;<br />
m1=start;<br />
if(m1==NULL)<br />
start=p1;<br />
else<br />
if(m1->link==NULL)<br />
m1->link=p1;<br />
else<br />
{<br />
while(m1->link!=NULL)<br />
{<br />
m1=m1->link;<br />
}<br />
}<br />
m1->link=p1;<br />
}<br />
f.close();<br />
p2=start;<br />
cout<<endl<<"Enter the account in which tra to be done = ";<br />
cin>>x;<br />
if(x==p2->info.ac_no)<br />
{<br />
cout<<"enter ammount:";<br />
int a,b,newbal;<br />
cin>>a;<br />
b=p2->info.balance;<br />
newbal=b-a;<br />
cout<<"new bal";<br />
}<br />
<br />
<br />
x=t.acc-9999;<br />
for(int i=1;i<=x-1;i++)<br />
{<br />
p2=p2->link;<br />
}<br />
t.bal=p2->info.balance;<br />
int temp;<br />
temp=t.bal;<br />
<br />
while(1)<br />
{<br />
t.bal=temp-t.amount;<br />
if(t.bal>500)<br />
{<br />
cout<<"\n\n sufficient credit limit";<br />
break;<br />
}<br />
cout<<"Enter Amount ";<br />
int a;<br />
cin>>a;<br />
t.amount=a;<br />
}<br />
<br />
cout<<"\n New balance is = ";<br />
cout<<t.bal;<br />
p2->info.balance=t.bal;<br />
cout<<"list bal="<< p2->info.balance<<endl;<br />
<br />
node *k;<br />
k=start;<br />
f.open("d:\\turboc3\\prob1.bin",ios::out|ios::binary);<br />
while(k!=NULL)<br />
{<br />
s.ac_no=k->info.ac_no;<br />
strcpy(s.name,k->info.name);<br />
// strcpy(s.dob,k->info.dob);<br />
strcpy(s.father,k->info.father);<br />
strcpy(s.address,k->info.address);<br />
strcpy(s.ph_no,k->info.ph_no);<br />
s.balance=k->info.balance;<br />
// strcpy(s.doc,k->info.doc);<br />
strcpy(s.status,k->info.status);<br />
strcpy(s.type,k->info.type);<br />
<br />
f.write((char*)&s,sizeof(s));<br />
k=k->link;<br />
}<br />
f.close();<br />
f2.write((char*)&t,sizeof(t));<br />
f2.close();<br />
<br />
}<br />
*/<br />
<br />
void withdraw1()<br />
{<br />
fstream f2,f;<br />
f2.open("d:\\turboc3\\tra.bin",ios::out|ios::app|ios::binary);<br />
t.gettra();<br />
strcpy(t.type,"Withdraw");<br />
int x,y;<br />
node *p2;<br />
start=NULL;<br />
f.open("d:\\turboc3\\prob1.bin",ios::in|ios::binary);<br />
while(!f.eof())<br />
{<br />
f.read((char*)&s,sizeof(s));<br />
if(f.eof())<br />
break;<br />
node *p1=new node;<br />
node *m1;<br />
p1->info.ac_no=s.ac_no;<br />
strcpy(p1->info.name,s.name);<br />
// strcpy(p1->info.dob,s.dob);<br />
strcpy(p1->info.father,s.father);<br />
strcpy(p1->info.address,s.address);<br />
strcpy(p1->info.ph_no,s.ph_no);<br />
p1->info.j=s.j;<br />
p1->info.balance=s.balance;<br />
strcpy(p1->info.type,s.type);<br />
strcpy(p1->info.status,s.status);<br />
// strcpy(p1->info.doc,s.doc);<br />
p1->link=NULL;<br />
m1=start;<br />
if(m1==NULL)<br />
start=p1;<br />
else<br />
if(m1->link==NULL)<br />
m1->link=p1;<br />
else<br />
{<br />
while(m1->link!=NULL)<br />
{<br />
m1=m1->link;<br />
}<br />
}<br />
m1->link=p1;<br />
}<br />
f.close();<br />
p2=start;<br />
// cout<<endl<<"Enter the account in which tra to be done = ";<br />
// cin>>x;<br />
x=t.acc-9999;<br />
cout<<"###################";<br />
cout<<x;<br />
for(int i=1;i<=x-1;i++)<br />
{<br />
p2=p2->link;<br />
}<br />
t.bal=p2->info.balance;<br />
int temp;<br />
temp=t.bal;<br />
<br />
while(1)<br />
{<br />
t.bal=temp-t.amount;<br />
if(t.bal>500)<br />
{<br />
cout<<"\n\n sufficient credit limit";<br />
break;<br />
}<br />
cout<<"Enter Amount ";<br />
int a;<br />
cin>>a;<br />
t.amount=a;<br />
}<br />
<br />
cout<<"\n New balance is = ";<br />
cout<<t.bal;<br />
p2->info.balance=t.bal;<br />
cout<<"list bal="<< p2->info.balance<<endl;<br />
node *k;<br />
k=start;<br />
f.open("d:\\turboc3\\prob1.bin",ios::out|ios::binary);<br />
while(k!=NULL)<br />
{<br />
s.ac_no=k->info.ac_no;<br />
strcpy(s.name,k->info.name);<br />
// strcpy(s.dob,k->info.dob);<br />
strcpy(s.father,k->info.father);<br />
strcpy(s.address,k->info.address);<br />
strcpy(s.ph_no,k->info.ph_no);<br />
s.balance=k->info.balance;<br />
// strcpy(s.doc,k->info.doc);<br />
strcpy(s.status,k->info.status);<br />
strcpy(s.type,k->info.type);<br />
f.write((char*)&s,sizeof(s));<br />
k=k->link;<br />
}<br />
f.close();<br />
f2.write((char*)&t,sizeof(t));<br />
f2.close();<br />
}<br />
<br />
void deposite()<br />
{<br />
fstream f2,f;<br />
f2.open("d:\\turboc3\\tra.bin",ios::out|ios::app|ios::binary);<br />
t.gettra2();<br />
strcpy(t.type,"DEPOSITE");<br />
int tempbal;<br />
int x,y;<br />
node *p2;<br />
start=NULL;<br />
f.open("d:\\turboc3\\prob1.bin",ios::in|ios::binary);<br />
while(!f.eof())<br />
{<br />
f.read((char*)&s,sizeof(s));<br />
if(f.eof())<br />
break;<br />
node *p1=new node;<br />
node *m1;<br />
p1->info.ac_no=s.ac_no;<br />
strcpy(p1->info.name,s.name);<br />
// strcpy(p1->info.dob,s.dob);<br />
strcpy(p1->info.father,s.father);<br />
strcpy(p1->info.address,s.address);<br />
strcpy(p1->info.ph_no,s.ph_no);<br />
p1->info.j=s.j;<br />
p1->info.balance=s.balance;<br />
strcpy(p1->info.type,s.type);<br />
strcpy(p1->info.status,s.status);<br />
// strcpy(p1->info.doc,s.doc);<br />
p1->link=NULL;<br />
m1=start;<br />
if(m1==NULL)<br />
start=p1;<br />
else<br />
if(m1->link==NULL)<br />
m1->link=p1;<br />
else<br />
{<br />
while(m1->link!=NULL)<br />
m1=m1->link;<br />
m1->link=p1;<br />
}<br />
<br />
}<br />
f.close();<br />
p2=start;<br />
x=t.acc-9999;<br />
cout<<"#############";<br />
cout<<x;<br />
<br />
for(int i=1;i<=x-1;i++)<br />
{<br />
p2=p2->link;<br />
}<br />
t.bal=p2->info.balance;<br />
t.bal=t.bal+t.amount;<br />
cout<<" New balance is = ";<br />
cout<<t.bal;<br />
p2->info.balance=t.bal;<br />
node *k;<br />
k=start;<br />
f.open("d:\\turboc3\\prob1.bin",ios::out|ios::binary);<br />
while(k!=NULL)<br />
{<br />
s.ac_no=k->info.ac_no;<br />
strcpy(s.name,k->info.name);<br />
// strcpy(s.dob,k->info.dob);<br />
strcpy(s.father,k->info.father);<br />
strcpy(s.address,k->info.address);<br />
strcpy(s.ph_no,k->info.ph_no);<br />
s.balance=k->info.balance;<br />
strcpy(s.type,k->info.type);<br />
// strcpy(s.doc,k->info.doc);<br />
strcpy(s.status,k->info.status);<br />
<br />
f.write((char*)&s,sizeof(s));<br />
k=k->link;<br />
}<br />
f.close();<br />
f2.write((char*)&t,sizeof(t));<br />
f2.close();<br />
}<br />
<br />
<br />
<br />
<br />
void showtraall1()<br />
{<br />
clrscr();<br />
fstream f2;<br />
f2.open("d:\\turboc3\\tra.bin",ios::in|ios::binary);<br />
if(f2.fail())<br />
{<br />
cout<<"File not found"<<endl;<br />
f2.close();<br />
return;<br />
}<br />
int i=47,j=2;<br />
while(1)<br />
{<br />
<br />
f2.read((char*)&t,sizeof(t));<br />
if(f2.eof())<br />
break;<br />
if(i==47)<br />
{<br />
gotoxy(1,1);<br />
cout<<"ACC NO";<br />
gotoxy(10,1);<br />
cout<<" DOT";<br />
gotoxy(20,1);<br />
cout<<"TRA CODE";<br />
gotoxy(28,1);<br />
cout<<" AMOUNT";<br />
gotoxy(36,1);<br />
cout<<"BALANCE";<br />
gotoxy(44,1);<br />
cout<<"MODE";<br />
gotoxy(52,1);<br />
cout<<"TYPE";<br />
i=2;<br />
//int j=2;<br />
}<br />
<br />
//if(t.montht>2&&t.montht<9&&t.yeart==2005)<br />
if((t.montht>9&&t.montht<=12&&t.yeart==2004)||(t.montht>=1&&t.montht<=3&&t.yeart==2005))<br />
<br />
{<br />
if(t.montht==10&&(t.dayt>=1&&t.dayt<=10))<br />
{<br />
<br />
sm=t.bal;<br />
tempo=sm;<br />
}<br />
else<br />
{<br />
if(sm>t.bal)<br />
{<br />
sm=t.bal;<br />
tempo=sm;<br />
//cout<<tempo;<br />
}<br />
}<br />
<br />
<br />
if(t.montht==10&&(t.dayt>=1&&t.dayt<=10))<br />
{<br />
sm=t.bal;<br />
tempo1=sm;<br />
}<br />
else<br />
{<br />
if(sm>t.bal)<br />
{<br />
sm=t.bal;<br />
tempo1=sm;<br />
}<br />
}<br />
}<br />
else<br />
{<br />
sm=t.bal;<br />
}<br />
}<br />
/*gotoxy(1,j);<br />
cout<<t.acc;<br />
gotoxy(10,j);<br />
cout<<t.dayt<<"/"<<t.montht<<"/"<<t.yeart;<br />
<br />
//cout<<t.dot;<br />
gotoxy(20,j);<br />
cout<<t.tracode;<br />
gotoxy(28,j);<br />
cout<<t.amount;<br />
gotoxy(36,j);<br />
cout<<t.bal;<br />
gotoxy(44,j);<br />
cout<<t.mode;<br />
gotoxy(52,j);<br />
cout<<t.type;<br />
j++;<br />
}<br />
} */<br />
f2.close();<br />
}<br />
//--------------------------------------------------------------------------<br />
<br />
void interest1()<br />
{<br />
fstream fi;<br />
inter ss;<br />
long min10,min30,min;<br />
long march=0,apr=0,may=0,june=0,july=0,aug=0;<br />
struct date d;<br />
getdate(&d);<br />
int year;<br />
year=d.da_year;<br />
fstream f2,f;<br />
f.open("d:\\turboc3\\prob1.bin",ios::in|ios::binary);<br />
if(f.fail())<br />
{<br />
cout<<"File not found"<<endl;<br />
f.close();<br />
return;<br />
}<br />
while(1)<br />
{<br />
f.read((char*)&s,sizeof(s));<br />
if(f.eof())<br />
break;<br />
for(int i=3;i<=8;i++)<br />
{ //3<br />
<br />
cout<<"fgesvfergverg===="<<i<<endl<<endl;<br />
<br />
f2.open("d:\\turboc3\\tra.bin",ios::in|ios::binary);<br />
if(f2.fail())<br />
{<br />
cout<<"File not found"<<endl;<br />
f2.close();<br />
return;<br />
}<br />
while(1)<br />
{<br />
f2.read((char*)&t,sizeof(t));<br />
if(f2.eof())<br />
break;<br />
if(s.ac_no==t.acc && t.montht==i && t.yeart==year-1)<br />
{ //5<br />
min10=min30=t.bal;<br />
break;<br />
}<br />
}<br />
f2.close();<br />
f2.open("d:\\turboc3\\tra.bin",ios::in|ios::binary);<br />
if(f2.fail())<br />
{<br />
cout<<"File not found"<<endl;<br />
f2.close();<br />
return;<br />
}<br />
<br />
while(1)<br />
{ //3<br />
f2.read((char*)&t,sizeof(t));<br />
if(f2.eof())<br />
break;<br />
cout<<"month====="<<t.montht<<endl<<endl;<br />
if( s.ac_no==t.acc && i==t.montht && year-1==t.yeart)<br />
{<br />
//if(t.dayt>=1 && t.dayt<=10)<br />
<br />
//if(i==t.montht)<br />
//{<br />
if(t.dayt==10)<br />
{<br />
if(t.bal<min10)<br />
{<br />
min10=t.bal;<br />
}}//4<br />
if(t.dayt>=11 && t.dayt<=31)<br />
{<br />
if(t.bal<min30)<br />
{<br />
min30=t.bal;<br />
}<br />
}<br />
<br />
cout<<endl<<s.ac_no<<endl<<t.dayt<<"/"<<t.montht<<"/"<<t.yeart<<endl;<br />
cout<<t.bal<<endl<<t.type<<" min10="<<min10<<" min30="<<min30<<endl;<br />
}<br />
getch();<br />
}<br />
//2<br />
if(min10<=min30)<br />
{<br />
min=min10;<br />
cout<<"min bal of "<<s.ac_no<<" in "<<i<<" month="<<min10<<endl;<br />
}<br />
else<br />
{<br />
min=min30;<br />
cout<<"min bal of "<<s.ac_no<<" in "<<i<<" month="<<min30<<endl;<br />
}<br />
if(i==3)<br />
march=min;<br />
else if(i==4)<br />
apr=min;<br />
else if(i==5)<br />
may=min;<br />
else if(i==6)<br />
june=min;<br />
else if(i==7)<br />
july=min;<br />
else if(i==8)<br />
aug=min;<br />
f2.close();<br />
}<br />
float interest=(march+apr+may+june+july+aug)*0.04*0.5;<br />
cout<<"\n\ninterest======"<<interest<<endl<<endl;<br />
fi.open("d:\\turboc3\\interest.bin",ios::app|ios::binary);<br />
if(fi.fail())<br />
{<br />
cout<<"File not found"<<endl;<br />
fi.close();<br />
return;<br />
}<br />
ss.accno=s.ac_no;<br />
ss.interest=interest;<br />
ss.balance=s.balance+ss.interest;<br />
fi.write((char*)&ss,sizeof(ss));<br />
fi.close();<br />
}<br />
//0<br />
f.close();<br />
f2.close();<br />
<br />
<br />
<br />
int tempbal;<br />
int x,y;<br />
node *p2;<br />
start=NULL;<br />
f.open("d:\\turboc3\\prob1.bin",ios::in|ios::binary);<br />
while(!f.eof())<br />
{<br />
f.read((char*)&s,sizeof(s));<br />
if(f.eof())<br />
break;<br />
node *p1=new node;<br />
node *m1;<br />
p1->info.ac_no=s.ac_no;<br />
strcpy(p1->info.name,s.name);<br />
// strcpy(p1->info.dob,s.dob);<br />
strcpy(p1->info.father,s.father);<br />
strcpy(p1->info.address,s.address);<br />
strcpy(p1->info.ph_no,s.ph_no);<br />
p1->info.j=s.j;<br />
p1->info.balance=s.balance;<br />
strcpy(p1->info.type,s.type);<br />
strcpy(p1->info.status,s.status);<br />
// strcpy(p1->info.doc,s.doc);<br />
p1->link=NULL;<br />
m1=start;<br />
if(m1==NULL)<br />
start=p1;<br />
else<br />
if(m1->link==NULL)<br />
m1->link=p1;<br />
else<br />
{<br />
while(m1->link!=NULL)<br />
m1=m1->link;<br />
m1->link=p1;<br />
}<br />
<br />
}<br />
f.close();<br />
<br />
fi.open("d:\\turboc3\\interest.bin",ios::in|ios::binary);<br />
if(fi.fail())<br />
{<br />
cout<<"File not found"<<endl;<br />
fi.close();<br />
return;<br />
}<br />
while(1)<br />
{<br />
fi.read((char*)&ss,sizeof(ss));<br />
<br />
if(fi.eof())<br />
{ fi.close();<br />
break;<br />
}<br />
p2=start;<br />
x=ss.accno-9999;<br />
cout<<"#############=";<br />
cout<<x;<br />
<br />
for(int i=1;i<=x-1;i++)<br />
{<br />
p2=p2->link;<br />
}<br />
p2->info.balance=ss.balance;<br />
cout<<" New balance is = "<<p2->info.balance<<endl;<br />
node *k;<br />
k=start;<br />
f.open("d:\\turboc3\\prob1.bin",ios::out|ios::binary);<br />
while(k!=NULL)<br />
{<br />
s.ac_no=k->info.ac_no;<br />
strcpy(s.name,k->info.name);<br />
// strcpy(s.dob,k->info.dob);<br />
strcpy(s.father,k->info.father);<br />
strcpy(s.address,k->info.address);<br />
strcpy(s.ph_no,k->info.ph_no);<br />
s.balance=k->info.balance;<br />
strcpy(s.type,k->info.type);<br />
// strcpy(s.doc,k->info.doc);<br />
strcpy(s.status,k->info.status);<br />
<br />
f.write((char*)&s,sizeof(s));<br />
k=k->link;<br />
}<br />
f.close();<br />
}<br />
<br />
fi.close();<br />
}<br />
<br />
<br />
void interest2()<br />
{<br />
inter ss;<br />
fstream fi;<br />
long min10,min30,min;<br />
long sep=0, oct=0,nov=0,dec=0,jan=0,feb=0;<br />
long interest;<br />
struct date d;<br />
<br />
getdate(&d);<br />
int year=d.da_year;<br />
fstream f2,f;<br />
<br />
<br />
f.close();<br />
f.open("d:\\turboc3\\prob1.bin",ios::in|ios::binary);<br />
if(f.fail())<br />
{<br />
cout<<"File not found"<<endl;<br />
f.close();<br />
return;<br />
}<br />
while(1)<br />
{<br />
f.read((char*)&s,sizeof(s));<br />
if(f.eof())<br />
break;<br />
for(int i=9;i<=12;i++)<br />
{<br />
cout<<"fgesvfergverg===="<<i<<endl<<endl;<br />
f2.open("d:\\turboc3\\tra.bin",ios::in|ios::binary);<br />
if(f2.fail())<br />
{<br />
cout<<"File not found"<<endl;<br />
f2.close();<br />
return;<br />
}<br />
while(1)<br />
{<br />
f2.read((char*)&t,sizeof(t));<br />
if(f2.eof())<br />
break;<br />
if(s.ac_no==t.acc && t.montht==i && t.yeart==year-1)<br />
{<br />
min10=min30=t.bal;<br />
break;<br />
}<br />
}<br />
f2.close();<br />
f2.open("d:\\turboc3\\tra.bin",ios::in|ios::binary);<br />
if(f2.fail())<br />
{<br />
cout<<"File not found"<<endl;<br />
f2.close();<br />
return;<br />
}<br />
<br />
while(1)<br />
{<br />
f2.read((char*)&t,sizeof(t));<br />
if(f2.eof())<br />
break;<br />
cout<<"month====="<<t.montht<<endl<<endl;<br />
if( s.ac_no==t.acc && i==t.montht && year-1==t.yeart)<br />
{<br />
<br />
//if(t.dayt>=1 && t.dayt<=10)<br />
<br />
//if(i==t.montht)<br />
//{<br />
if(t.dayt==10)<br />
{<br />
if(t.bal<min10)<br />
{<br />
min10=t.bal;<br />
}}<br />
if(t.dayt>=11 && t.dayt<=31)<br />
{<br />
if(t.bal<min30)<br />
{<br />
min30=t.bal;<br />
}<br />
}<br />
<br />
cout<<endl<<s.ac_no<<endl<<t.dayt<<"/"<<t.montht<<"/"<<t.yeart<<endl;<br />
cout<<t.bal<<endl<<t.type<<" min10="<<min10<<" min30="<<min30<<endl;<br />
}<br />
getch();<br />
}<br />
//-----------------------<br />
<br />
if(min10<=min30)<br />
{<br />
min=min10;<br />
cout<<"min bal of "<<s.ac_no<<" in "<<i<<" month="<<min10<<endl;<br />
}<br />
else<br />
{<br />
min=min30;<br />
cout<<"min bal of "<<s.ac_no<<" in "<<i<<" month="<<min30<<endl;<br />
}<br />
if(i==9)<br />
sep=min;<br />
else if(i==10)<br />
oct=min;<br />
else if(i==11)<br />
nov=min;<br />
else if(i==12)<br />
dec=min;<br />
f2.close();<br />
}<br />
interest=(sep+oct+nov+dec)*0.04*0.5;<br />
cout<<"\n\ninterest======"<<interest<<endl<<endl;<br />
fi.open("d:\\turboc3\\interest1.bin",ios::app|ios::binary);<br />
if(fi.fail())<br />
{<br />
cout<<"File not found"<<endl;<br />
fi.close();<br />
return;<br />
}<br />
ss.accno=s.ac_no;<br />
ss.interest=interest;<br />
ss.balance=s.balance+ss.interest;<br />
fi.write((char*)&ss,sizeof(ss));<br />
fi.close();<br />
}<br />
<br />
<br />
<br />
//-----------------------<br />
/*if(min10<=min30)<br />
cout<<"min bal of "<<s.ac_no<<" in "<<i<<" month="<<min10<<endl;<br />
else<br />
cout<<"min bal of "<<s.ac_no<<" in "<<i<<" month="<<min30<<endl;<br />
f2.close();<br />
}<br />
} */<br />
f.close();<br />
f2.close();<br />
//--------------------<br />
f.open("d:\\turboc3\\prob1.bin",ios::in|ios::binary);<br />
if(f.fail())<br />
{<br />
cout<<"File not found"<<endl;<br />
f.close();<br />
return;<br />
}<br />
while(1)<br />
{<br />
f.read((char*)&s,sizeof(s));<br />
if(f.eof())<br />
break;<br />
<br />
for(int i=1;i<=2;i++)<br />
{<br />
cout<<"fgesvfergverg===="<<i<<endl<<endl;<br />
<br />
f2.open("d:\\turboc3\\tra.bin",ios::in|ios::binary);<br />
if(f2.fail())<br />
{<br />
cout<<"File not found"<<endl;<br />
f2.close();<br />
return;<br />
}<br />
while(1)<br />
{//2<br />
f2.read((char*)&t,sizeof(t));<br />
if(f2.eof())<br />
break;<br />
if(s.ac_no==t.acc && t.montht==i && t.yeart==year)<br />
{<br />
min10=min30=t.bal;<br />
break;<br />
}<br />
}<br />
f2.close();<br />
f2.open("d:\\turboc3\\tra.bin",ios::in|ios::binary);<br />
if(f2.fail())<br />
{<br />
cout<<"File not found"<<endl;<br />
f2.close();<br />
return;<br />
} //1<br />
<br />
while(1)<br />
{<br />
f2.read((char*)&t,sizeof(t));<br />
if(f2.eof())<br />
break;<br />
cout<<"month====="<<t.montht<<endl<<endl;<br />
if( s.ac_no==t.acc && i==t.montht && year==t.yeart)<br />
{<br />
<br />
if(t.dayt==10)<br />
{<br />
if(t.bal<min10)<br />
{<br />
min10=t.bal;<br />
}}<br />
<br />
if(t.dayt>=11 && t.dayt<=31)<br />
{<br />
if(t.bal<min30)<br />
{<br />
min30=t.bal;<br />
}<br />
} //3<br />
<br />
cout<<endl<<s.ac_no<<endl<<t.dayt<<"/"<<t.montht<<"/"<<t.yeart<<endl;<br />
cout<<t.bal<<endl<<t.type<<" min10="<<min10<<" min30="<<min30<<endl;<br />
}<br />
getch();<br />
}<br />
//------------------<br />
if(min10<=min30)<br />
{<br />
min=min10;<br />
cout<<"min bal of "<<s.ac_no<<" in "<<i<<" month="<<min10<<endl;<br />
}<br />
else<br />
{<br />
min=min30;<br />
cout<<"min bal of "<<s.ac_no<<" in "<<i<<" month="<<min30<<endl;<br />
}<br />
if(i==1)<br />
jan=min;<br />
else if(i==2)<br />
feb=min;<br />
<br />
f2.close();<br />
}<br />
float interest=(jan+feb)*0.04*0.5;<br />
cout<<"\n\ninterest======"<<interest<<endl<<endl;<br />
fi.open("d:\\turboc3\\interest1.bin",ios::app|ios::binary);<br />
if(fi.fail())<br />
{<br />
cout<<"File not found"<<endl;<br />
fi.close();<br />
return;<br />
}<br />
ss.accno=s.ac_no;<br />
ss.interest=interest;<br />
ss.balance=s.balance+ss.interest;<br />
fi.write((char*)&ss,sizeof(ss));<br />
fi.close();<br />
}<br />
<br />
<br />
//---------<br />
/*if(min10<=min30)<br />
cout<<"min bal of "<<s.ac_no<<" in "<<i<<" month="<<min10<<endl;<br />
else<br />
cout<<"min bal of "<<s.ac_no<<" in "<<i<<" month="<<min30<<endl;<br />
f2.close();<br />
}<br />
} */<br />
<br />
f.close();<br />
f2.close();<br />
//-------------------------------------------------------------------<br />
int tempbal;<br />
int x,y;<br />
node *p2;<br />
start=NULL;<br />
f.open("d:\\turboc3\\prob1.bin",ios::in|ios::binary);<br />
while(!f.eof())<br />
{<br />
f.read((char*)&s,sizeof(s));<br />
if(f.eof())<br />
break;<br />
node *p1=new node;<br />
node *m1;<br />
p1->info.ac_no=s.ac_no;<br />
strcpy(p1->info.name,s.name);<br />
// strcpy(p1->info.dob,s.dob);<br />
strcpy(p1->info.father,s.father);<br />
strcpy(p1->info.address,s.address);<br />
strcpy(p1->info.ph_no,s.ph_no);<br />
p1->info.j=s.j;<br />
p1->info.balance=s.balance;<br />
strcpy(p1->info.type,s.type);<br />
strcpy(p1->info.status,s.status);<br />
// strcpy(p1->info.doc,s.doc);<br />
p1->link=NULL;<br />
m1=start;<br />
if(m1==NULL)<br />
start=p1;<br />
else<br />
if(m1->link==NULL)<br />
m1->link=p1;<br />
else<br />
{<br />
while(m1->link!=NULL)<br />
m1=m1->link;<br />
m1->link=p1;<br />
}<br />
<br />
}<br />
f.close();<br />
<br />
fi.open("d:\\turboc3\\interest.bin",ios::in|ios::binary);<br />
if(fi.fail())<br />
{<br />
cout<<"File not found"<<endl;<br />
fi.close();<br />
return;<br />
}<br />
while(1)<br />
{<br />
fi.read((char*)&ss,sizeof(ss));<br />
<br />
if(fi.eof())<br />
{ fi.close();<br />
break;<br />
}<br />
p2=start;<br />
x=ss.accno-9999;<br />
cout<<"#############=";<br />
cout<<x;<br />
<br />
for(int i=1;i<=x-1;i++)<br />
{<br />
p2=p2->link;<br />
}<br />
p2->info.balance=ss.balance;<br />
cout<<" New balance is = "<<p2->info.balance<<endl;<br />
node *k;<br />
k=start;<br />
f.open("d:\\turboc3\\prob1.bin",ios::out|ios::binary);<br />
while(k!=NULL)<br />
{<br />
s.ac_no=k->info.ac_no;<br />
strcpy(s.name,k->info.name);<br />
// strcpy(s.dob,k->info.dob);<br />
strcpy(s.father,k->info.father);<br />
strcpy(s.address,k->info.address);<br />
strcpy(s.ph_no,k->info.ph_no);<br />
s.balance=k->info.balance;<br />
strcpy(s.type,k->info.type);<br />
// strcpy(s.doc,k->info.doc);<br />
strcpy(s.status,k->info.status);<br />
<br />
f.write((char*)&s,sizeof(s));<br />
k=k->link;<br />
}<br />
f.close();<br />
}<br />
<br />
fi.close();<br />
}<br />
<br />
//--------------------------------------------------------------------------<br />
void showtraall()<br />
{<br />
clrscr();<br />
fstream f2;<br />
f2.open("d:\\turboc3\\tra.bin",ios::in|ios::binary);<br />
if(f2.fail())<br />
{<br />
cout<<"File not found"<<endl;<br />
f2.close();<br />
return;<br />
}<br />
int i=47,j=2;<br />
<br />
while(1)<br />
{<br />
<br />
f2.read((char*)&t,sizeof(t));<br />
if(f2.eof())<br />
break;<br />
if(i==47)<br />
{<br />
gotoxy(1,1);<br />
cout<<"ACC NO";<br />
gotoxy(10,1);<br />
cout<<" DOT";<br />
gotoxy(20,1);<br />
cout<<"TRA CODE";<br />
gotoxy(28,1);<br />
cout<<" AMOUNT";<br />
gotoxy(36,1);<br />
cout<<"BALANCE";<br />
gotoxy(44,1);<br />
cout<<"MODE";<br />
gotoxy(52,1);<br />
cout<<"TYPE";<br />
i=2;<br />
//int j=2;<br />
}<br />
<br />
gotoxy(1,j);<br />
cout<<t.acc;<br />
gotoxy(10,j);<br />
cout<<t.dayt<<"/"<<t.montht<<"/"<<t.yeart;<br />
<br />
//cout<<t.dot;<br />
gotoxy(20,j);<br />
cout<<t.tracode;<br />
gotoxy(28,j);<br />
cout<<t.amount;<br />
gotoxy(36,j);<br />
cout<<t.bal;<br />
gotoxy(44,j);<br />
cout<<t.mode;<br />
gotoxy(52,j);<br />
cout<<t.type;<br />
j++;<br />
}<br />
<br />
<br />
f2.close();<br />
}<br />
<br />
void addtratolist()<br />
{<br />
fstream f2;<br />
<br />
start2=NULL;<br />
f2.open("d:\\turboc3\\tra.bin",ios::in|ios::binary);<br />
while(!f2.eof())<br />
{<br />
f2.read((char*)&t,sizeof(t));<br />
if(f2.eof())<br />
break;<br />
node2 *p2=new node2;<br />
node2 *m2;<br />
p2->info.acc=t.acc;<br />
p2->info.tracode=t.tracode;<br />
p2->info.dayt,t.dayt;<br />
p2->info.montht,t.montht;<br />
p2->info.yeart,t.yeart;<br />
p2->info.amount=t.amount;<br />
strcpy(p2->info.mode,t.mode);<br />
p2->link=NULL;<br />
m2=start2;<br />
if(m2==NULL)<br />
start2=p2;<br />
else<br />
if(m2->link==NULL)<br />
m2->link=p2;<br />
else<br />
{<br />
while(m2->link!=NULL)<br />
m2=m2->link;<br />
m2->link=p2;<br />
}<br />
<br />
}<br />
f2.close();<br />
}<br />
<br />
<br />
void addtratofile()<br />
{ fstream f2;<br />
node *k;<br />
k=start2;<br />
f2.open("d:\\turboc3\\tra.bin",ios::out|ios::binary);<br />
while(k!=NULL)<br />
{<br />
t.acc=k->info.acc;<br />
t.tracode=k->info.tracode;<br />
<br />
t.dayt=k->info.dayt;<br />
t.montht=k->info.montht;<br />
t.yeart=k->info.yeart;<br />
<br />
<br />
t.amount=k->info.amount;<br />
strcpy(t.mode,k->info.mode);<br />
f.write((char*)&t,sizeof(t));<br />
k=k->link;<br />
}<br />
f2.close();<br />
}<br />
<br />
void report2()<br />
{<br />
<br />
int temp;<br />
int x,y,count=0;<br />
cout<<"enter account no.";<br />
cin>>temp;<br />
node2 *p2;<br />
node2 *save,*ptr;<br />
node2 *ptr1;<br />
addtratolist();<br />
int i=0;<br />
ptr1=new node2;<br />
ptr1=start2;<br />
while(ptr1!=NULL)<br />
{<br />
if( ptr1->info.acc==temp)<br />
{<br />
cout<<"acc found"<<endl;<br />
i=1;<br />
cout<<"\n is :";<br />
cout<<ptr1->info.acc;<br />
cout<<"\ntracode is :";<br />
cout<<ptr1->info.tracode;<br />
cout<<"\n date of transfer is :";<br />
cout<<ptr1->info.dayt<<"/"<<ptr1->info.montht<<"/"<<ptr1->info.yeart;<br />
<br />
cout<<"\n mode is :";<br />
cout<<ptr1->info.mode;<br />
cout<<"\n amount is :";<br />
cout<<ptr1->info.amount;<br />
<br />
}<br />
ptr1=ptr1->link;<br />
count++;<br />
}<br />
if(i==0)<br />
{<br />
cout<<"No member corressponding to this Account no. exists";<br />
getch();<br />
return;<br />
}<br />
}<br />
<br />
<br />
<br />
void report3()<br />
{<br />
<br />
int temp;<br />
int x,y,count=0;<br />
cout<<"enter transaction code no.";<br />
cin>>temp;<br />
node2 *p2;<br />
node2 *save,*ptr;<br />
node2 *ptr1;<br />
addtratolist();<br />
int i=0;<br />
ptr1=new node2;<br />
ptr1=start2;<br />
while(ptr1!=NULL)<br />
{<br />
if( ptr1->info.tracode==temp)<br />
{<br />
cout<<"transaction code found"<<endl;<br />
i=1;<br />
cout<<"\n account in which tra is done is :";<br />
cout<<ptr1->info.acc;<br />
cout<<"\ntracode is :";<br />
cout<<ptr1->info.tracode;<br />
cout<<"\n date of transfer is :";<br />
// cout<<ptr1->info.dot;<br />
cout<<ptr1->info.dayt<<"/"<<ptr1->info.montht<<"/"<<ptr1->info.yeart;<br />
cout<<"\n mode is :";<br />
cout<<ptr1->info.mode;<br />
cout<<"\n amount is :";<br />
cout<<ptr1->info.amount;<br />
<br />
}<br />
ptr1=ptr1->link;<br />
count++;<br />
}<br />
if(i==0)<br />
{<br />
cout<<"No member corressponding to this tracode no. exists";<br />
getch();<br />
return;<br />
}<br />
}<br />
<br />
void report4()<br />
{<br />
<br />
char temp[22];<br />
int x,y,count=0;<br />
cout<<"enter mode no.";<br />
cin>>temp;<br />
node2 *p2;<br />
node2 *save,*ptr;<br />
node2 *ptr1;<br />
addtratolist();<br />
int i=0;<br />
ptr1=new node2;<br />
ptr1=start2;<br />
while(ptr1!=NULL)<br />
{<br />
if( strcmp(ptr1->info.mode,temp)==0)<br />
{<br />
cout<<"mode of transaction found found"<<endl;<br />
i=1;<br />
cout<<"\n account in which tra is done is :";<br />
cout<<ptr1->info.acc;<br />
cout<<"\ntracode is :";<br />
cout<<ptr1->info.tracode;<br />
cout<<"\n date of transfer is :";<br />
// cout<<ptr1->info.dot;<br />
cout<<ptr1->info.dayt<<"/"<<ptr1->info.montht<<"/"<<ptr1->info.yeart;<br />
cout<<"\n mode is :";<br />
cout<<ptr1->info.mode;<br />
cout<<"\n amount is :";<br />
cout<<ptr1->info.amount;<br />
<br />
}<br />
ptr1=ptr1->link;<br />
count++;<br />
}<br />
if(i==0)<br />
{<br />
cout<<"No member corressponding to this tracode no. exists";<br />
getch();<br />
return;<br />
}<br />
}<br />
<br />
void report5()<br />
{<br />
<br />
int tempd;<br />
int tempm;<br />
int tempy;<br />
int x,y,count=0;<br />
cout<<"enter dot no.";<br />
cin>>tempd ;<br />
cin>>tempm;<br />
cin>>tempy;<br />
<br />
node2 *p2;<br />
node2 *save,*ptr;<br />
node2 *ptr1;<br />
addtratolist();<br />
int i=0;<br />
ptr1=new node2;<br />
ptr1=start2;<br />
while(ptr1!=NULL)<br />
{<br />
if( ptr1->info.dayt==tempd&&ptr1->info.montht==tempm&&ptr1->info.yeart==tempy)<br />
{<br />
cout<<"dot found"<<endl;<br />
i=1;<br />
cout<<"\n account in which tra is done is :";<br />
cout<<ptr1->info.acc;<br />
cout<<"\ntracode is :";<br />
cout<<ptr1->info.tracode;<br />
cout<<"\n date of transfer is :";<br />
cout<<ptr1->info.dayt<<"/"<<ptr1->info.montht<<"/"<<ptr1->info.yeart;<br />
<br />
cout<<"\n mode is :";<br />
cout<<ptr1->info.mode;<br />
cout<<"\n amount is :";<br />
cout<<ptr1->info.amount;<br />
<br />
}<br />
ptr1=ptr1->link;<br />
count++;<br />
}<br />
if(i==0)<br />
{<br />
cout<<"No member corressponding to this tracode no. exists";<br />
getch();<br />
return;<br />
}<br />
}<br />
<br />
};<br />
<br />
int isNum(char m[])<br />
{<br />
for(int i=0;m[i]!='\0';i++)<br />
if(m[i]<48||m[i]>57)<br />
return 0;<br />
<br />
return 1;<br />
}<br />
<br />
int menu()<br />
{<br />
char choice[10];<br />
int chs;<br />
clrscr();<br />
cout<<"*************************"<<endl;<br />
cout<<"1.ACCOUNT MANAGEMENT"<<endl;<br />
cout<<"2.TRANSACTION"<<endl;<br />
cout<<"3.BALANCE"<<endl;<br />
cout<<"4.REPORT"<<endl;<br />
cout<<"5.EXIT"<<endl;<br />
cout<<"6.DELETE FILE"<<endl;<br />
cout<<"Enter your choice : ";<br />
gets(choice);<br />
if(!isNum(choice))<br />
{<br />
cout<<"Enter a valid choice...Press any key to get Menu again"<<endl;<br />
getch();<br />
menu();<br />
}<br />
chs=atoi(choice);<br />
return chs;<br />
}<br />
<br />
int menu2()<br />
{<br />
char choic[10];<br />
int ch2;<br />
clrscr();<br />
cout<<"*************************"<<endl;<br />
cout<<"1.NEW ACCOUNT "<<endl;<br />
cout<<"2.CHANGE DETAILS OF ACCOUNT"<<endl;<br />
cout<<"3.CHANGE DETAIL OF JOINT MEM"<<endl;<br />
cout<<"4.SHOW DETAIL OF ALL THE ACCOUNTS"<<endl;<br />
cout<<"5.SEARCH ACCOUNT"<<endl;<br />
cout<<"6.Exit"<<endl;<br />
cout<<"7.change status"<<endl;<br />
cout<<"*************************"<<endl;<br />
cout<<"Enter your choice : ";<br />
gets(choic);<br />
if(!isNum(choic))<br />
{<br />
cout<<"Enter a valid choice...Press any key to get Menu again"<<endl;<br />
<br />
getch();<br />
}<br />
ch2=atoi(choic);<br />
return ch2;<br />
}<br />
<br />
int menu3()<br />
{<br />
<br />
char choic[10];<br />
int ch2;<br />
clrscr();<br />
cout<<"*************************"<<endl;<br />
cout<<"1.WITHDRAWL"<<endl;<br />
cout<<"2.DEPOSITE"<<endl;<br />
cout<<"3.CALCULATE INTEREST"<<endl;<br />
cout<<"4.SHOW BAL"<<endl;<br />
cout<<"5.BACK"<<endl;<br />
cout<<"*************************"<<endl;<br />
cout<<"Enter your choice : ";<br />
gets(choic);<br />
if(!isNum(choic))<br />
{<br />
cout<<"Enter a valid choice...Press any key to get Menu again"<<endl;<br />
<br />
getch();<br />
}<br />
ch2=atoi(choic);<br />
return ch2;<br />
}<br />
<br />
<br />
int menu4()<br />
{<br />
char choic4[10];<br />
int ch4;<br />
clrscr();<br />
cout<<"*************************"<<endl;<br />
cout<<"1.REPORT OF ALL THE TRANSACTION DONE"<<endl;<br />
cout<<"2.REPORT ON TRANSCATION ON PARTICULAR ACCOUNT"<<endl;<br />
cout<<"3.REPORT OF PARTICULAR TRANSACTION CODE"<<endl;<br />
cout<<"4.REPORT ON mode:"<<endl;<br />
cout<<"6.REPOT OF ALL ACCOUNT HOLDERS"<<endl;<br />
cout<<"5.Exit"<<endl;<br />
cout<<"7.report on dot"<<endl;<br />
<br />
cout<<"*************************"<<endl;<br />
cout<<"Enter your choice : ";<br />
gets(choic4);<br />
if(!isNum(choic4))<br />
{<br />
cout<<"Enter a valid choice...Press any key to get Menu again"<<endl;<br />
<br />
<br />
getch();<br />
}<br />
ch4=atoi(choic4);<br />
return ch4;<br />
}<br />
<br />
void report9()<br />
{<br />
fstream fi;<br />
inter ss;<br />
fi.open("d:\\turboc3\\interest.bin",ios::in|ios::binary);<br />
if(fi.fail())<br />
{<br />
cout<<"File not found"<<endl;<br />
fi.close();<br />
return;<br />
}<br />
cout<<"\nACCOUNT NO\tINTEREST\tBALANCE\n";<br />
while(1)<br />
{<br />
fi.read((char*)&ss,sizeof(ss));<br />
if(fi.eof())<br />
break;<br />
cout<<endl<<ss.accno<<"\t\t"<<ss.interest<<"\t\t"<<ss.balance<<endl;<br />
}<br />
fi.close();<br />
}<br />
void main()<br />
{<br />
trans ss;<br />
mem dd;<br />
transaction z;<br />
<br />
fstream h;<br />
h.open("d:\\turboc3\\tra.bin",ios::binary|ios::app|ios::in);<br />
h.seekg(0,ios::end);<br />
transactioncode=h.tellg()/sizeof(ss);<br />
transactioncode=transactioncode+1000;<br />
h.close();<br />
<br />
<br />
fstream hh;<br />
hh.open("d:\\turboc3\\prob1.bin",ios::binary|ios::app|ios::in);<br />
hh.seekg(0,ios::end);<br />
accountnumber=hh.tellg()/sizeof(dd);<br />
cout<<"&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&=="<<accountnumber<<endl;<br />
getch();<br />
accountnumber=accountnumber+10000;<br />
<br />
hh.close();<br />
<br />
records r;<br />
clrscr();<br />
start:<br />
<br />
<br />
int chx;<br />
while(1)<br />
{<br />
chx=menu();<br />
switch(chx)<br />
{<br />
case 1:<br />
cout<<"\n\t ACCOUNT MANAGEMENT \n";<br />
int chm2;<br />
while(1)<br />
{<br />
<br />
chm2=menu2();<br />
switch(chm2)<br />
{<br />
case 1:<br />
cout<<"\n ADD NEW ACCOUNT :";<br />
r.add();<br />
break;<br />
case 2:<br />
cout<<"CHANGE PERSONAL DETAIL OF MEMBER:";<br />
r.modifyrec();<br />
break;<br />
case 3:<br />
cout<<"\n CHANGE PERSONAL DETAIL OF JOINT MEMBER:";<br />
r.modifyjointrec();<br />
break;<br />
case 4:<br />
cout<<"\n show personal info of all account:";<br />
r.showall();<br />
<br />
break;<br />
case 5:<br />
cout<<"\n search particular i nfo account";<br />
r.searcha();<br />
<br />
break;<br />
case 6:<br />
cout<<"\n exit";<br />
cout<<"loading.............";<br />
goto start;<br />
<br />
case 7:<br />
cout<<"\n change status of account";<br />
r.change();<br />
break;<br />
<br />
<br />
getch();<br />
break;<br />
}<br />
getch();<br />
}<br />
break ;<br />
case 2:<br />
cout<<"\n\t TRANSACTION:";<br />
<br />
int chm3;<br />
while(1)<br />
{<br />
<br />
chm3=menu3();<br />
switch(chm3)<br />
{<br />
case 1:<br />
cout<<"\n WITHDRAWL";<br />
z.withdraw1();<br />
break;<br />
case 2:<br />
cout<<"\n DEPOSITE";<br />
z.deposite();<br />
break;<br />
case 3:<br />
cout<<"\n CALCULATE INTERSEST ";<br />
z.interest1();<br />
//z.showtraall1();<br />
break;<br />
case 4:<br />
cout<<"\n SHOW BALANCE:";<br />
r.showall();<br />
break;<br />
case 5:<br />
cout<<"\n EXIT :";<br />
cout<<"\n loading.............";<br />
getch();<br />
goto start;<br />
}<br />
getch();<br />
}<br />
goto start;<br />
break;<br />
case 3:<br />
cout<<"\n\t BALANCE:";<br />
break;<br />
case 4:<br />
cout<<"\n\tREPORT";<br />
<br />
<br />
int chm4;<br />
while(1)<br />
{<br />
<br />
chm4=menu4();<br />
switch(chm4)<br />
{<br />
case 1:<br />
cout<<"\n REPORT OF TRA OF all ACC";<br />
z.showtraall();<br />
break;<br />
case 2:<br />
cout<<"\n REPORT OF TRA ON PARTICULAR account";<br />
z.report2();<br />
break;<br />
case 3:<br />
cout<<"\n REPORT OF PARTICULAR TRASACTION CODE:";<br />
z.report3();<br />
break;<br />
case 4:<br />
cout<<"\n REPORT ON PE=ARTICULAR MODE:";<br />
z.report4();<br />
break;<br />
<br />
<br />
case 6:<br />
cout<<"\n REPORT ON all the account :";<br />
r.showall();<br />
break;<br />
<br />
case 7:<br />
cout<<"\n REPORT ON dot:";<br />
z.report5();<br />
break;<br />
<br />
case 8:<br />
cout<<"\n REPORT ON INTEREST:";<br />
report9();<br />
break;<br />
<br />
<br />
case 5:<br />
cout<<"\n EXIT :";<br />
cout<<"\n loading.............";<br />
getch();<br />
goto start;<br />
}<br />
getch();<br />
}<br />
goto start;<br />
break;<br />
<br />
case 5:<br />
cout<<"Thanx for using s/w..."<<endl<<"loading...................";<br />
cout<<endl<<"now press any key to continue";<br />
getch();<br />
exit(0);<br />
case 6:<br />
remove("d:\\turboc3\\prob1.bin");<br />
remove("d:\\turboc3\\joint.bin");<br />
remove("d:\\turboc3\\tra.bin");<br />
break;<br />
<br />
}<br />
getch();<br />
}<br />
getch();<br />
<br />
}<br />
<br />
<br />
<br />
/*<br />
struct inter<br />
{<br />
<br />
int a_cc;<br />
int tra_code;<br />
char do_t[100];<br />
int amo_unt;<br />
char mo_de[100];<br />
int ba_l;<br />
<br />
public:<br />
void getint();<br />
void showint();<br />
fstream x;<br />
};<br />
<br />
void inter::getint()<br />
{<br />
<br />
cout<<"Enter acc No : "; cin>>a_cc;<br />
cout<<"Enter tracode: ";<br />
tracode= transactioncode;<br />
transactioncode++;<br />
cout<<tracode;<br />
<br />
cout<<"Enter do_t : ";gets(do_t);<br />
cout<<"Enter amount: ";cin>>amount;<br />
cout<<"enter mode:";<br />
gets(mode);<br />
if(strcmp(mode,"cheq")==0)<br />
{<br />
cout<<"transfer by cheq:";<br />
cout<<"\n enter cheque no";gets(cheqno);<br />
cout<<"\n enter date of cheque"; gets(docheq);<br />
cout<<"\n enter bank name"; gets(bank);<br />
cout<<"\n enter branch"; gets(branch);<br />
<br />
<br />
}<br />
<br />
if(strcmp(mode,"dd")==0)<br />
{<br />
cout<<"\n transfer by demand draft:";<br />
cout<<"\n enter demand draft no:";gets(ddno);<br />
cout<<"\n enter demand draft date";gets(dodd);<br />
}<br />
if(strcmp(mode,"translip")==0)<br />
{<br />
cout<<"transfer by transfer slip:";<br />
<br />
}<br />
if(strcmp(mode,"atm")==0)<br />
{<br />
cout<<"transfer by atm:";<br />
}<br />
<br />
}<br />
<br />
void trans::showtra()<br />
{<br />
cout<<"acc no is:";cout<<acc;<br />
cout<<"tracode is"; cout<<tracode;<br />
cout<<"dot:"; puts(dot);<br />
cout<<"amount"; cout<<amount;<br />
cout<<"mode:"; puts(mode);<br />
if(strcmp(mode,"cheq")==0)<br />
{<br />
cout<<"transfer by cheq:";<br />
cout<<"\n cheque no";puts(cheqno);<br />
cout<<"\n date of cheque"; puts(docheq);<br />
cout<<"\n bank name"; puts(bank);<br />
cout<<"\n branch"; puts(branch);<br />
<br />
<br />
}<br />
<br />
if(strcmp(mode,"dd")==0)<br />
{<br />
cout<<"transfer by demand draft:";<br />
cout<<"\n demand draft no:";puts(ddno);<br />
cout<<"\n demand draft date";puts(dodd);<br />
}<br />
}<br />
<br />
<br />
class transaction<br />
{<br />
trans t;<br />
mem s;<br />
long bal;<br />
<br />
int rec;<br />
node *start;<br />
public:<br />
transaction()<br />
{<br />
start=NULL;<br />
} */Upinder Singh Dhamihttp://www.blogger.com/profile/10526677796017634649noreply@blogger.com0tag:blogger.com,1999:blog-6297953299971051513.post-57995136523222712162009-09-01T18:36:00.001+05:302009-09-01T18:36:09.545+05:30project of editor(like notepad) in c++#include<iostream.h><br />
#include<conio.h><br />
#include<graphics.h><br />
#include<dos.h><br />
#include<string.h><br />
#include<fstream.h><br />
#include<process.h><br />
<br />
void getkey(int&,int&,int&); // IT DETECT ANY KEY<br />
void lostfocus_c(); // IT WILL RUB ONE CHARACTER<br />
void lostfocus_l(int); // IT WILL RUB THE COMPLETE LINE<br />
void lostfocus_p(int); // IT WILL RUB ALL TEXT AFTER THE CURSOR<br />
// INCLUDING WITH THAT LINE IN WHICH CURSOR IS PRESENT<br />
void cursor_draw(int); // IT WILL DRAW THE BLACK CURSOR<br />
void cursor_lost(); // IT WILL RUB THE CURSOR<br />
void box(); // IT WILL DRAW THE FRAME OF EDITOR<br />
void file(); // IT WILL SAVE THE FILE<br />
void leftarrow();<br />
void rightarrow();<br />
void uparrow();<br />
void downarrow();<br />
void enter();<br />
void backspace();<br />
void alphabet();<br />
char s1[2],s2[80]; // S2 STORES THE VALUE OF CURRENT STRING<br />
char str[46][80]; // STR STORE THE WHOLE EDITOR TEXT<br />
int cur=0,max=0,tp=60,bk=15,text=6,pixx=0,pixy=60,font=2,ln;<br />
int hor=1,temp,statl=0,statt=-1,s,a,p,bx1=10,by1=39,bx2=348,by2=480,box_clr=6;<br />
char ch;<br />
<br />
<br />
void main()<br />
{ // max will give how many strings have been enterd in the array and<br />
// cur will give the current position in the array of string<br />
//s2 will have the string being enterd by the user<br />
int d,m;<br />
d=DETECT;<br />
initgraph(&d,&m,"c:\\tc");<br />
strcpy(s2,"");<br />
setbkcolor(YELLOW);<br />
setcolor(text);<br />
settextstyle(0,HORIZ_DIR,font);<br />
box();<br />
cursor_draw(0);<br />
while(1)<br />
{ getkey(s,a,p);<br />
switch(s)<br />
{ //esc key<br />
case 1: /*int gg=0;<br />
for(int i=0;i<=max;i++)<br />
{ outtextxy(300,gg,str[i]);<br />
gg+=18;<br />
}<br />
getch();*/<br />
return;<br />
<br />
//save<br />
case 60: file();<br />
break;<br />
<br />
//uparrow<br />
case 72: uparrow();<br />
break;<br />
<br />
//downarrow<br />
case 80: downarrow();<br />
break;<br />
<br />
// right arrow key<br />
case 77: rightarrow();<br />
break;<br />
<br />
//left arrow key<br />
case 75: leftarrow();<br />
break;<br />
<br />
//enter key<br />
default: switch(a)<br />
{ //enter<br />
case 13: enter();<br />
break;<br />
<br />
//backspace<br />
case 8: backspace();<br />
break;<br />
default: alphabet();<br />
break;<br />
}<br />
}<br />
}<br />
file();<br />
closegraph();<br />
}<br />
<br />
void file()<br />
{ ofstream f;<br />
f.open("c:/dhamii.txt",ios::out|ios::in);<br />
if(f.fail())<br />
{ outtextxy(10,10,"file cannot open correctly");<br />
getch();<br />
return;<br />
}<br />
for(int i=0;i<=max;i++)<br />
{ f<<str[i]<<endl;<br />
}<br />
f.close();<br />
}<br />
<br />
void getkey(int &sc,int &ac,int &sp)<br />
{ REGS ix,ox;<br />
ix.h.ah=0x00;<br />
int86(0x16,&ix,&ox);<br />
sc=ox.h.ah;<br />
ac=ox.h.al;<br />
ix.h.ah=0x02;<br />
int86(0x16,&ix,&ox);<br />
sp=ox.h.al;<br />
}<br />
<br />
void box()<br />
{ setcolor(bk);<br />
<br />
int butn=4;<br />
// setcolor(box_clr);<br />
rectangle(bx1+5,by1+5,bx2-11,by2-11);<br />
setfillstyle(1,bk);<br />
floodfill(bx1+12,by1+12,bk);<br />
setcolor(box_clr);<br />
int a[]={bx1,by1,bx2,by1,bx2,by1+4,bx1+4,by1+4,bx1+4,by2,bx1,by2,bx1,by1};<br />
setfillstyle(3,box_clr);<br />
/* draw a filled polygon */<br />
fillpoly(7,a);<br />
floodfill(bx1,by1,box_clr);<br />
int b[]={bx2-10,by1+5,bx2,by1+5,bx2,by2,bx1+5,by2,bx1+5,by2-10,bx2-10,by2-10,bx2-10,by1+5};<br />
setfillstyle(9,box_clr);<br />
fillpoly(7,b);<br />
//right top button<br />
setcolor(butn);<br />
rectangle(bx2-10,by1+5,bx2,by1+20);<br />
line(bx2-10,by1+15,bx2,by1+15);<br />
setfillstyle(1,butn);<br />
floodfill(bx2-8,by1+17,butn);<br />
int c[]={bx2-10,by1+5,bx2,by1+5,bx2-5,by1+14,bx2-10,by1+5};<br />
setfillstyle(1,butn);<br />
fillpoly(4,c);<br />
//right bottom button<br />
rectangle(bx2-10,by2-25,bx2,by2-10);<br />
line(bx2-10,by2-20,bx2,by2-20);<br />
setfillstyle(1,butn);<br />
floodfill(bx2-8,by2-23,butn);<br />
int d[]={bx2-5,by2-19,bx2,by2-10,bx2-10,by2-10,bx2-5,by2-19};<br />
setfillstyle(1,butn);<br />
fillpoly(4,d);<br />
//lower right button<br />
rectangle(bx2-25,by2-10,bx2-10,by2);<br />
line(bx2-20,by2-10,bx2-20,by2);<br />
setfillstyle(1,butn);<br />
floodfill(bx2-23,by2-8,butn);<br />
int e[]={bx2-19,by2-5,bx2-10,by2-10,bx2-10,by2,bx2-19,by2-5};<br />
setfillstyle(1,butn);<br />
fillpoly(4,e);<br />
//lower left button<br />
rectangle(bx1+5,by2-10,bx1+20,by2);<br />
line(bx1+15,by2-10,bx1+15,by2);<br />
setfillstyle(1,butn);<br />
floodfill(bx1+17,by2-8,butn);<br />
int f[]={bx1+5,by2-10,bx1+14,by2-5,bx1+5,by2,bx1+5,by2-10};<br />
setfillstyle(1,butn);<br />
fillpoly(4,f);<br />
setcolor(text);<br />
}<br />
<br />
// Function to wash the particular character<br />
void lostfocus_c()<br />
{ int len;<br />
char ch[2];<br />
// len=strlen(s2);<br />
if(pixx!=16)<br />
{ cursor_lost();<br />
len=pixx/(8*font)-2/font;<br />
pixx=pixx-8*font;<br />
}<br />
else<br />
{ if(tp!=60)<br />
{ cursor_lost();<br />
cur--;<br />
strcpy(s2,str[cur]);<br />
tp=tp-10*font;<br />
pixx=8*font*(strlen(s2))+8*font;<br />
}<br />
else<br />
return;<br />
}<br />
cursor_draw(1);<br />
ch[0]=s2[len-1];<br />
ch[1]='\0';<br />
setcolor(bk);<br />
outtextxy(pixx+1,tp,ch);<br />
setcolor(text);<br />
}<br />
<br />
void lostfocus_l(int x)<br />
{ setcolor(bk);<br />
outtextxy(17,tp,str[cur]);<br />
setcolor(text);<br />
}<br />
<br />
void lostfocus_p(int x)<br />
{ setcolor(bk);<br />
temp=tp;<br />
for(int i=x;i<=max;i++)<br />
{ outtextxy(17,temp,str[i]);<br />
temp=temp+10*font;<br />
}<br />
setcolor(text);<br />
}<br />
<br />
void cursor_draw(int l)<br />
{ int len;<br />
if(l==0)<br />
{ len=strlen(s2);<br />
//if(len==0)<br />
//{ pixx=16;<br />
//}<br />
//else<br />
pixx=8*font*len+16;<br />
pixy=cur*font*10+60;<br />
setcolor(8);<br />
line(pixx,pixy-2,pixx,pixy+7*font+1);<br />
setcolor(text);<br />
<br />
}<br />
else<br />
{ pixy=cur*font*10+60;<br />
setcolor(8);<br />
line(pixx,pixy-2,pixx,pixy+7*font+1);<br />
setcolor(text);<br />
}<br />
/* while(!kbhit())<br />
{cursor_lost();<br />
delay(50);<br />
line(pixx,pixy,pixx,pixy+8);<br />
delay(50);<br />
}*/<br />
}<br />
<br />
void cursor_lost()<br />
{ setcolor(bk);<br />
line(pixx,pixy-2,pixx,pixy+7*font+1);<br />
setcolor(text);<br />
}<br />
<br />
void uparrow()<br />
{ strcpy(str[cur],s2);<br />
if(cur>0)<br />
{ cursor_lost();<br />
cur--;<br />
strcpy(s2,str[cur]);<br />
tp=tp-10*font;<br />
if(strlen(s2)*font*8>=pixx)<br />
cursor_draw(1);<br />
else<br />
cursor_draw(0);<br />
}<br />
}<br />
void downarrow()<br />
{ strcpy(str[cur],s2);<br />
if(cur<max)<br />
{ cursor_lost();<br />
cur++;<br />
strcpy(s2,str[cur]);<br />
tp=tp+10*font;<br />
if(strlen(s2)*font*8>=pixx)<br />
cursor_draw(1);<br />
else<br />
cursor_draw(0);<br />
}<br />
}<br />
<br />
void leftarrow()<br />
{ ln=strlen(s2);<br />
if(pixx!=16)<br />
{ cursor_lost();<br />
pixx=pixx-8*font;<br />
cursor_draw(1);<br />
}<br />
else<br />
{ if(cur>0)<br />
{ cursor_lost();<br />
cur--;<br />
strcpy(s2,str[cur]);<br />
tp=tp-10*font;<br />
cursor_draw(0);<br />
}<br />
}<br />
<br />
}<br />
<br />
void rightarrow()<br />
{ ln=strlen(s2);<br />
if(ln*8*font+16!=pixx)<br />
{ cursor_lost();<br />
pixx=pixx+8*font;<br />
cursor_draw(1);<br />
}<br />
else<br />
{ if(cur<max)<br />
{ cursor_lost();<br />
cur++;<br />
strcpy(s2,str[cur]);<br />
tp=tp+10*font;<br />
pixx=16;<br />
pixy=pixy+font*10;<br />
cursor_draw(1);<br />
}<br />
}<br />
}<br />
<br />
void enter()<br />
{ int remng_char;<br />
ln=strlen(str[cur]);<br />
temp=ln*font*8+16;<br />
//enter in this loop when there is no character after tha cursor<br />
//in that line and the rest of the editor<br />
if(max==cur&&temp==pixx)<br />
{ cursor_lost();<br />
strcpy(str[cur],s2);<br />
strcpy(s2,"");<br />
if(cur==max)<br />
{ max++;<br />
}<br />
cur++;<br />
tp+=10*font;<br />
cursor_draw(0);<br />
}<br />
else<br />
{ char stgr[50];<br />
strcpy(s2,str[cur]);<br />
//remng_char is the no of remaning character in the<br />
//current line after the cursor<br />
remng_char=(temp-pixx)/8*font;<br />
cursor_lost();<br />
lostfocus_p(cur);<br />
lostfocus_l(cur);<br />
for(int i=0;i<max-cur;i++)<br />
{ strcpy(str[max-i+1],str[max-i]);<br />
}<br />
max++;<br />
temp=tp+2*10*font;<br />
for(i=cur+2;i<=max;i++)<br />
{ outtextxy(17,temp,str[i]);<br />
temp=temp+10*font;<br />
}<br />
int m=ln-remng_char;<br />
int ii=0;<br />
for(i=0;i<remng_char;i++)<br />
{ stgr[ii]=str[cur][m];<br />
ii++;<br />
m++;<br />
}<br />
/* while(s2[i]!='\0')<br />
{stg[ii]=s2[i];<br />
ii++;<br />
i++;<br />
}*/<br />
stgr[ii]='\0';<br />
// strupr(stgr);<br />
outtextxy(400,100,stgr);<br />
/* s2[ln-remng_char]='\0';<br />
strcpy(str[cur],s2);<br />
cursor_lost();<br />
outtextxy(17,tp,s2);<br />
/* cur++;<br />
tp=tp+10*font;<br />
strcpy(str[cur],stg);<br />
strcpy(s2,stg);<br />
outtextxy(17,tp,s2);<br />
pixx=16;<br />
cursor_draw(1); */<br />
}<br />
}<br />
<br />
void backspace()<br />
{ int pos;<br />
//code for backspace key<br />
// lostfocus(tp);<br />
ln=strlen(s2);<br />
if(pixx!=16)<br />
{ pos=pixx/(8*font)-2/font;<br />
pixx=pixx+8*font*(ln-pos);<br />
for(int i=0;i<=ln-pos;i++)<br />
{ lostfocus_c();<br />
}<br />
for(i=0;i<ln-pos;i++)<br />
{ s2[pos+i-1]=s2[pos+i];<br />
}<br />
s2[ln-1]='\0';<br />
strcpy(str[cur],s2);<br />
outtextxy(17,tp,s2);<br />
}<br />
else<br />
{ int temp1;<br />
temp=strlen(str[cur]);<br />
ln=strlen(str[cur-1]);<br />
if(temp+ln<=40/font&&tp!=60)<br />
{ lostfocus_p(cur);<br />
cursor_lost();<br />
strcat(str[cur-1],str[cur]);<br />
// lostfocus_p(cur-1);<br />
for(int i=cur;i<max;i++)<br />
{ strcpy(str[i],str[i+1]);<br />
}<br />
strcpy(str[max],"");<br />
max--;<br />
temp1=tp;<br />
outtextxy(17,tp-10*font,str[cur-1]);<br />
for(i=cur;i<=max;i++)<br />
{ outtextxy(17,tp,str[i]);<br />
temp1=temp1+10*font;<br />
}<br />
tp=tp-10*font;<br />
cur--;<br />
strcpy(s2,str[cur]);<br />
pixx=pixx+8*font*ln;<br />
cursor_draw(1);<br />
}<br />
else<br />
{ if(tp!=60)<br />
{ int pos,ln1;<br />
char stg[50];<br />
ln=strlen(str[cur-1]);<br />
pos=40/font-ln;<br />
for(int i=0;i<pos;i++)<br />
{ stg[i]=str[cur][i];<br />
}<br />
stg[i]='\0';<br />
cursor_lost();<br />
lostfocus_l(cur);<br />
strcat(str[cur-1],stg);<br />
strrev(s2);<br />
ln1=strlen(s2);<br />
s2[ln1-pos]='\0';<br />
strrev(s2);<br />
outtextxy(17,tp,s2);<br />
strcpy(str[cur],s2);<br />
pixx=pixx+8*ln*font;<br />
// cursor_draw(1);<br />
cur--;<br />
tp=tp-10*font;<br />
cursor_draw(1);<br />
strcpy(s2,str[cur]);<br />
outtextxy(17,tp,s2);<br />
}<br />
}<br />
}<br />
}<br />
<br />
void alphabet()<br />
{ // code for any other alphabet<br />
ln=strlen(s2);<br />
if(ln<40/font)<br />
{ //put character when editing is in the last line<br />
if(cur==max)<br />
{ cursor_lost();<br />
s1[0]=a;<br />
s1[1]='\0';<br />
strupr(s1);<br />
strcat(s2,s1);<br />
outtextxy(17,tp,s2);<br />
strcpy(str[cur],s2);<br />
cursor_draw(0);<br />
}<br />
//put any character in partial filled line<br />
else<br />
{ ln=strlen(s2);<br />
if(ln!=40/font)<br />
{ if(pixx!=ln*8*font+16)<br />
{ int pos;<br />
lostfocus_l(cur);<br />
pos=pixx/(8*font)-2/font;<br />
for(int i=0;i<=ln-pos;i++)<br />
{ s2[ln-i+1]=s2[ln-i];<br />
}<br />
s2[pos]=a;<br />
strupr(s2);<br />
outtextxy(17,tp,s2);<br />
strcpy(str[cur],s2);<br />
cursor_lost();<br />
pixx=pixx+8*font;<br />
cursor_draw(1);<br />
}<br />
else<br />
{ cursor_lost();<br />
s1[0]=a;<br />
s1[1]='\0';<br />
strupr(s1);<br />
strcat(s2,s1);<br />
outtextxy(17,tp,s2);<br />
strcpy(str[cur],s2);<br />
cursor_draw(0);<br />
}<br />
}<br />
}<br />
}<br />
//put character at the last of any line<br />
else<br />
{ if(pixx==336)<br />
{ lostfocus_p(cur);<br />
for(int i=0;i<(max-cur);i++)<br />
{ strcpy(str[max-i+1],str[max-i]);<br />
}<br />
max++;<br />
temp=tp+2*10*font;<br />
for(i=cur+2;i<=max;i++)<br />
{ outtextxy(17,temp,str[i]);<br />
temp=temp+10*font;<br />
}<br />
outtextxy(17,tp,str[cur]);<br />
tp=tp+10*font;<br />
cur++;<br />
cursor_lost();<br />
s1[0]=a;<br />
s1[1]='\0';<br />
strupr(s1);<br />
strcpy(s2,"");<br />
strcat(s2,s1);<br />
outtextxy(17,tp,s2);<br />
cursor_draw(0);<br />
strcpy(str[cur],s2);<br />
}<br />
else<br />
{ //put any character in completely filled line<br />
if(statl==0&&statt==-1)<br />
{ lostfocus_p(cur);<br />
for(int i=0;i<=(max-cur+1);i++)<br />
{ strcpy(str[max-i+1],str[max-i]);<br />
}<br />
max++;<br />
temp=tp+2*10*font;<br />
for(i=cur+2;i<=max;i++)<br />
{ outtextxy(17,temp,str[i]);<br />
temp=temp+10*font;<br />
}<br />
int pos;<br />
ln=strlen(s2);<br />
lostfocus_l(cur);<br />
pos=pixx/(8*font)-2/font;<br />
for(i=0;i<=ln-pos;i++)<br />
{ s2[ln-i+1]=s2[ln-i];<br />
}<br />
s2[pos]=a;<br />
s1[0]=s2[ln];<br />
s1[1]='\0';<br />
s2[ln]='\0';<br />
strupr(s2);<br />
strcpy(str[cur],s2);<br />
outtextxy(17,tp,str[cur]);<br />
tp=tp+10*font;<br />
cur++;<br />
cursor_lost();<br />
//s1[0]=a;<br />
// s1[1]='\0';<br />
strupr(s1);<br />
strcpy(s2,"");<br />
strcat(s2,s1);<br />
outtextxy(17,tp,s2);<br />
// cursor_draw(0);<br />
strcpy(str[cur],s2);<br />
cur--;<br />
tp=tp-10*font;<br />
strcpy(s2,str[cur]);<br />
pixx=pixx+8*font;<br />
cursor_draw(1);<br />
statt=tp;<br />
statl=1;<br />
}<br />
else<br />
{ int pos;<br />
ln=strlen(s2);<br />
lostfocus_l(cur);<br />
pos=pixx/(8*font)-2/font;<br />
for(int i=0;i<=ln-pos;i++)<br />
{ s2[ln-i+1]=s2[ln-i];<br />
}<br />
s2[pos]=a;<br />
s1[0]=s2[ln];<br />
s1[1]='\0';<br />
s2[ln]='\0';<br />
strupr(s2);<br />
strcpy(str[cur],s2);<br />
outtextxy(17,tp,str[cur]);<br />
tp=tp+10*font;<br />
cur++;<br />
cursor_lost();<br />
//s1[0]=a;<br />
// s1[1]='\0';<br />
strupr(s1);<br />
strcpy(s2,str[cur]);<br />
lostfocus_l(cur);<br />
strcat(s2,s1);<br />
strrev(s2);<br />
outtextxy(17,tp,s2);<br />
// cursor_draw(0);<br />
strcpy(str[cur],s2);<br />
cur--;<br />
tp=tp-10*font;<br />
strcpy(s2,str[cur]);<br />
pixx=pixx+8*font;<br />
cursor_draw(1);<br />
statt=tp;<br />
statl=1;<br />
}<br />
}<br />
}<br />
}Upinder Singh Dhamihttp://www.blogger.com/profile/10526677796017634649noreply@blogger.com0tag:blogger.com,1999:blog-6297953299971051513.post-83036492396144773152009-09-01T18:33:00.001+05:302009-09-01T18:33:02.212+05:30program of text box#include<iostream.h><br />
#include<conio.h><br />
#include<stdio.h><br />
#include<graphics.h><br />
#include<dos.h><br />
char s1[2],s2[50],p[4][50];<br />
int lf,tp,rh,bt;<br />
lf=225;<br />
rh=lf+130;<br />
tp=150;<br />
bt=tp+40;<br />
<br />
void setfocus(int l,int r,int t,int b,char s[])<br />
{<br />
setcolor(15);<br />
rectangle(l,t,r,b);<br />
setfillstyle(1,15);<br />
floodfill(l+2,t+2,15);<br />
setcolor(6);<br />
outtextxy(l+5,t,s);<br />
}<br />
<br />
void lostfocus(int l,int r,int t,int b,char s[])<br />
{<br />
setcolor(7);<br />
rectangle(l,t,r,b);<br />
setfillstyle(1,7);<br />
floodfill(l+2,t+2,7);<br />
setcolor(6);<br />
outtextxy(l+5,t,s);<br />
}<br />
<br />
void menu(char x[][50],int msize,int hl)<br />
{<br />
<br />
setcolor(5);<br />
settextstyle(1,HORIZ_DIR,5);<br />
outtextxy(200,60,x[0]);<br />
<br />
settextstyle(1,HORIZ_DIR,4);<br />
for(int i=1;i<=msize;i++)<br />
{ if(i==hl)<br />
setfocus(lf,rh,tp,bt,x[i]);<br />
else<br />
lostfocus(lf,rh,tp,bt,x[i]);<br />
tp+=40;<br />
bt+=40;<br />
}<br />
}<br />
<br />
void getkey(int &j,int &k,int &l)<br />
{ REGS n,m;<br />
m.h.ah=0X00;<br />
int86(22,&m,&n);<br />
j=n.h.ah;<br />
k=n.h.al;<br />
m.h.ah=0X02;<br />
int86(22,&m,&n);<br />
l=n.h.al;<br />
}<br />
<br />
void main()<br />
{ int d,m,e;<br />
d=DETECT;<br />
initgraph(&d,&m,"c:/tc");<br />
e=graphresult();<br />
<br />
if(e!=0)<br />
{<br />
cout<<"Graphics not inialised";<br />
getch();<br />
return;<br />
}<br />
<br />
settextstyle(1,HORIZ_DIR,2);<br />
setbkcolor(7);<br />
int ac,sc,st,z=1;<br />
while(1)<br />
{ setfocus(lf,rh,tp,bt,s2);<br />
<br />
getkey(sc,ac,st);<br />
if(sc==72 && z>=1)<br />
{<br />
if(z==1)<br />
{ z=5;<br />
continue;<br />
}<br />
z--;<br />
}<br />
else if(sc==80&& z<=5)<br />
{<br />
z++;<br />
if(z==6)<br />
z=1;<br />
}<br />
else if(sc==1)<br />
break;<br />
else if(sc==28)<br />
{<br />
}<br />
}<br />
getch();<br />
closegraph();<br />
}Upinder Singh Dhamihttp://www.blogger.com/profile/10526677796017634649noreply@blogger.com0tag:blogger.com,1999:blog-6297953299971051513.post-35164519051382277392009-09-01T18:32:00.001+05:302009-09-01T18:32:16.240+05:30program to show the basics os screen saver#include<iostream.h><br />
#include<conio.h><br />
#include<graphics.h><br />
#include<dos.h><br />
#include<alloc.h><br />
#include<stdlib.h><br />
void main()<br />
{ clrscr();<br />
int gd=DETECT,gm,area;<br />
initgraph(&gd,&gm,"c:/tc");<br />
void *buff,*buff1;<br />
setbkcolor(WHITE);<br />
setcolor(RED);<br />
setfillstyle(1,RED );<br />
circle(10,10,9);<br />
floodfill(10,10,RED);<br />
area=imagesize(1,1,20,20);<br />
buff=malloc(area);<br />
getimage(1,1,20,20,buff);<br />
<br />
setcolor(WHITE);<br />
setfillstyle(1,WHITE );<br />
rectangle(1,1,20,20);<br />
circle(10,10,9);<br />
floodfill(10,10,WHITE);<br />
area=imagesize(1,1,20,20);<br />
buff1=malloc(area);<br />
getimage(1,1,20,20,buff1);<br />
for(int i=0;i<500;i++)<br />
{ // i=i+10;<br />
putimage(i,50,buff,0);<br />
delay(20);<br />
putimage(i,50,buff1,0);<br />
}<br />
getch();<br />
}Upinder Singh Dhamihttp://www.blogger.com/profile/10526677796017634649noreply@blogger.com0tag:blogger.com,1999:blog-6297953299971051513.post-37594091833305663772009-09-01T18:31:00.001+05:302009-09-01T18:31:46.912+05:30program of digital switches#include<iostream.h><br />
#include<conio.h><br />
#include<stdio.h><br />
#include<graphics.h><br />
#include<dos.h><br />
int aaa=80,bbb=150;<br />
<br />
void buttan(int,int,int,int);<br />
void circl(int,int,int);<br />
void main()<br />
{ int d,mm,e,a,b,c,k;<br />
d=DETECT;<br />
initgraph(&d,&mm,"c:/tc");<br />
e=graphresult();<br />
<br />
if(e!=0)<br />
{<br />
cout<<"Graphics not inialised";<br />
getch();<br />
return;<br />
}<br />
<br />
setbkcolor(BLUE);<br />
<br />
for(int ii=0;ii<4;ii++)<br />
{<br />
buttan(aaa,bbb,15,8);<br />
circl(aaa+30,bbb+50,1);<br />
aaa+=138;<br />
<br />
}<br />
aaa=80;<br />
bbb=150;<br />
REGS n,m;<br />
n.x.ax=0;<br />
int86(0x33,&n,&m);<br />
k=m.x.ax;<br />
if(k==0)<br />
return;<br />
int aa,bb,t1,t2,p=0;<br />
while(!kbhit())<br />
{ n.x.ax=1;<br />
int86(0x33,&n,&m);<br />
n.x.ax=3;<br />
int86(0x33,&n,&m);<br />
a=m.x.cx;<br />
b=m.x.dx;<br />
c=m.x.bx;<br />
if(c==1 && a>aaa && a<(aaa+58) && b>bbb && b<(bbb+33))<br />
{<br />
buttan(aaa,bbb,8,15);<br />
delay(200);<br />
circl((aaa+30),(bbb+50),1);<br />
buttan(aaa,bbb,15,8);<br />
continue;<br />
}<br />
if(c==1 && a>(aaa+138) && a<(aaa+196) && b>bbb&&b<(bbb+33))<br />
{<br />
buttan((aaa+138),bbb,8,15);<br />
delay(200);<br />
circl((aaa+168),(bbb+50),4);<br />
buttan((aaa+138),bbb,15,8);<br />
continue;<br />
}<br />
}<br />
getch();<br />
closegraph();<br />
}<br />
<br />
void buttan(int x, int y,int ltcolor,int rtcolor)<br />
{<br />
<br />
setcolor(7);<br />
rectangle(x,y,x+50,y+25);<br />
setfillstyle(1,7);<br />
floodfill(x+2,y+2,7);<br />
<br />
setcolor(ltcolor);<br />
int a[]={ x-4,y-4,x+54,y-4,x+50,y,x,y,x,y+25,x-4,y+29,x-4,y-4};<br />
drawpoly(7,a);<br />
setfillstyle(1,ltcolor);<br />
floodfill(x-3,y-3,ltcolor);<br />
<br />
setcolor(rtcolor);<br />
int b[]={x+54,y-4,x+54,y+29,x-4,y+29,x,y+25,x+50,y+25,x+50,y,x+54,y-4};<br />
drawpoly(7,b);<br />
setfillstyle(1,rtcolor);<br />
floodfill(x+52,y+10,rtcolor);<br />
<br />
setcolor(1);<br />
outtextxy(x+13,y+10,"J&U");<br />
}<br />
<br />
void circl(int xx,int yy,int zz)<br />
{<br />
setcolor(RED);<br />
circle(xx,yy,10);<br />
setfillstyle(1,zz);<br />
floodfill(xx,yy,RED);<br />
}Upinder Singh Dhamihttp://www.blogger.com/profile/10526677796017634649noreply@blogger.com0tag:blogger.com,1999:blog-6297953299971051513.post-35379779288611825212009-09-01T18:30:00.003+05:302009-09-01T18:30:58.284+05:30program which draw rectangles on the screen with the help of mouse#include<iostream.h><br />
#include<conio.h><br />
#include<dos.h><br />
#include<graphics.h><br />
int a,b,c,k;<br />
void main()<br />
{ clrscr();<br />
int d,mm,e;<br />
d=DETECT;<br />
initgraph(&d,&mm,"c:/tc");<br />
e=graphresult();<br />
if(e!=0)<br />
{ cout<<" graphics r not opened";<br />
getch();<br />
return;<br />
}<br />
setbkcolor(7);<br />
REGS n,m;<br />
n.x.ax=0;<br />
int86(0x33,&n,&m);<br />
k=m.x.ax;<br />
if(k==0)<br />
return;<br />
int aa,bb,t1=0,t2=0,p=0,g=0;<br />
while(!kbhit())<br />
{ n.x.ax=1;<br />
int86(0x33,&n,&m);<br />
n.x.ax=3;<br />
int86(0x33,&n,&m);<br />
a=m.x.cx;<br />
b=m.x.dx;<br />
c=m.x.bx;<br />
<br />
if(c==1)<br />
{ g=1;<br />
if(p==0)<br />
{ aa=a;<br />
bb=b;<br />
p++;<br />
}<br />
if(t1!=a||t2!=b)<br />
{ setcolor(7);<br />
rectangle(aa,bb,t1,t2);<br />
// cleardevice();<br />
}<br />
t1=a;<br />
t2=b;<br />
setcolor(1);<br />
rectangle(aa,bb,a,b);<br />
<br />
}<br />
else<br />
{ p=0;<br />
if(g==1)<br />
{ rectangle(aa,bb,t1,t2);<br />
g=0;<br />
}<br />
}<br />
}<br />
getch();<br />
closegraph();<br />
}Upinder Singh Dhamihttp://www.blogger.com/profile/10526677796017634649noreply@blogger.com0tag:blogger.com,1999:blog-6297953299971051513.post-87383979811315691022009-09-01T18:30:00.001+05:302009-09-01T18:30:27.468+05:30program which takes a number from keyboard and gives it ascii value,scan code and status code#include<iostream.h><br />
#include<conio.h><br />
#include<dos.h><br />
void getkey(int &ac,int &sc,int&st)<br />
{ REGS m,n;<br />
m.h.ah=0x00;<br />
int86(22,&m,&n);<br />
sc=n.h.ah;<br />
ac=n.h.al;<br />
m.h.ah=0x02;<br />
int86(22,&m,&n);<br />
st=n.h.al;<br />
}<br />
void main()<br />
{ clrscr();<br />
REGS m,n;<br />
int sc,ac,st;<br />
m.h.ah=0x00;<br />
int86(22,&m,&n);<br />
sc=n.h.ah;<br />
ac=n.h.al;<br />
m.h.ah=0x02;<br />
int86(22,&m,&n);<br />
st=n.h.al;<br />
cout<<"scan code: "<<sc<<endl;<br />
cout<<"ascii code: "<<ac<<endl;<br />
cout<<"status code: "<<st<<endl;<br />
getch();<br />
}Upinder Singh Dhamihttp://www.blogger.com/profile/10526677796017634649noreply@blogger.com0tag:blogger.com,1999:blog-6297953299971051513.post-44058690071085385372009-09-01T18:29:00.003+05:302009-09-01T18:29:53.075+05:30program to show menu with the cursor#include<iostream.h><br />
#include<conio.h><br />
#include<stdio.h><br />
#include<graphics.h><br />
#include<dos.h><br />
#include<process.h><br />
int color;<br />
void arrow(int xx,int yy,int color)<br />
{ setcolor(color);<br />
int a[]={xx-50,yy+7,xx-40,yy+7,xx-20,yy+20,xx-40,yy+33,xx-50,yy+33,xx-50,yy+26,xx-40,yy+26,xx-27,yy+20,xx-40,yy+14,xx-50,yy+14,xx-50,yy+7};<br />
drawpoly(11,a);<br />
setfillstyle(1,color);<br />
floodfill(xx-40,yy+10,color);<br />
}<br />
<br />
void msetfocus(int l,int r,int t,int b,char s[])<br />
{ arrow(l,t,8);<br />
setcolor(15);<br />
rectangle(l,t,r,b);<br />
setfillstyle(1,15);<br />
floodfill(l+2,t+2,15);<br />
setcolor(6);<br />
outtextxy(l+5,t,s);<br />
}<br />
<br />
void mlostfocus(int l,int r,int t,int b,char s[])<br />
{ arrow(l,t,7);<br />
setcolor(7);<br />
rectangle(l,t,r,b);<br />
setfillstyle(1,7);<br />
floodfill(l+2,t+2,7);<br />
setcolor(6);<br />
outtextxy(l+5,t,s);<br />
}<br />
<br />
void menu(char x[][50],int msize,int hl)<br />
{<br />
int lf,tp,rh,bt;<br />
lf=175;<br />
rh=lf+225;<br />
tp=150;<br />
bt=tp+40;<br />
setcolor(5);<br />
settextstyle(1,HORIZ_DIR,4);<br />
outtextxy(140,60,x[0]);<br />
<br />
settextstyle(1,HORIZ_DIR,2);<br />
for(int i=1;i<=msize;i++)<br />
{ if(i==hl)<br />
msetfocus(lf,rh,tp,bt,x[i]);<br />
else<br />
mlostfocus(lf,rh,tp,bt,x[i]);<br />
tp+=40;<br />
bt+=40;<br />
}<br />
}<br />
<br />
void getkey(int &j,int &k,int &l)<br />
{ REGS n,m;<br />
m.h.ah=0X00;<br />
int86(22,&m,&n);<br />
j=n.h.ah;<br />
k=n.h.al;<br />
m.h.ah=0X02;<br />
int86(22,&m,&n);<br />
l=n.h.al;<br />
}<br />
<br />
void main()<br />
{ int d,mm,e,a,b,c,k;<br />
d=DETECT;<br />
initgraph(&d,&mm,"c:/tc");<br />
e=graphresult();<br />
<br />
if(e!=0)<br />
{<br />
cout<<"Graphics not inialised";<br />
getch();<br />
return;<br />
}<br />
REGS n,m;<br />
n.x.ax=0;<br />
int86(0x33,&n,&m);<br />
k=m.x.ax;<br />
if(k==0)<br />
return;<br />
while(!kbhit())<br />
{ n.x.ax=1;<br />
int86(0x33,&n,&m);<br />
n.x.ax=3;<br />
int86(0x33,&n,&m);<br />
a=m.x.cx; /* lf=175;<br />
rh=lf+225;<br />
tp=150;<br />
bt=tp+40; */<br />
b=m.x.dx;<br />
c=m.x.bx;<br />
<br />
}<br />
settextstyle(1,HORIZ_DIR,2);<br />
setbkcolor(7);<br />
int ac,sc,st,z=1,t=1;<br />
char mstr[][50]={"STUDEMT'S DATABASE","INSERT NEW RECORD ","SHOW ALL RECORD","SEARCH A RECORD","DELETE A RECORD ","MODIFY A RECORD"};<br />
while(1)<br />
{<br />
menu(mstr,5,z);<br />
getkey(sc,ac,st);<br />
/*sound(7);<br />
delay(100);<br />
nosound(); */<br />
if(sc==72 && z>=1)<br />
{<br />
if(z==1)<br />
{ z=5;<br />
continue;<br />
}<br />
z--;<br />
}<br />
else if(sc==80&& z<=5)<br />
{<br />
z++;<br />
if(z==6)<br />
z=1;<br />
}<br />
else if(sc==1)<br />
break;<br />
else if(sc==28)<br />
{ exit(0);<br />
}<br />
}<br />
getch();<br />
closegraph();<br />
}Upinder Singh Dhamihttp://www.blogger.com/profile/10526677796017634649noreply@blogger.com0tag:blogger.com,1999:blog-6297953299971051513.post-82504612509510740272009-09-01T18:29:00.001+05:302009-09-01T18:29:18.458+05:30program of moving 3dimensional rectangle box#include <stdio.h><br />
#include <dos.h><br />
#include <graphics.h><br />
#include <conio.h><br />
<br />
#define MAGFY 20<br />
<br />
class Bline<br />
{<br />
private:<br />
int CEN_X,CEN_Y,radius,X,Y,i,j;<br />
public:<br />
void line1(int x1,int y1,int x2,int y2,int x3,int y3,int x4,int y4);<br />
<br />
};<br />
<br />
void Bline::line1(int x1,int y1,int x2,int y2,int x3,int y3,int x4,int y4)<br />
{<br />
CEN_X = (x1+x2)/2 + (x3-x2)/2;<br />
CEN_Y = (y1+y2)/2 + (y3-y2)/2;<br />
//radius = (x1+x2)/2;<br />
for(;!kbhit();)<br />
{<br />
delay(300);<br />
cleardevice();<br />
//1st box<br />
line(x1,y1,x2,y2);<br />
line(x1,y1-20,x2,y2-20); //<br />
line(x3,y3,x4,y4);<br />
line(x3,y3-20,x4,y4-20); //<br />
line(x1,y1,x4,y4);<br />
line(x1,y1-20,x4,y4-20); //<br />
line(x2,y2,x3,y3);<br />
line(x2,y2-20,x3,y3-20); //<br />
<br />
//2nd box<br />
line(x1,y1,x1,y1-20);<br />
line(x2,y2,x2,y2-20);<br />
line(x3,y3,x3,y3-20);<br />
line(x4,y4,x4,y4-20);<br />
<br />
//some point which will be moving around 3Dbox<br />
//line(x2+40,y2-20,x2+40,y2-20);<br />
//rectangle(x2,y2,x4,y4);<br />
<br />
//1st Quadrant<br />
if(x1>CEN_X && y1<CEN_Y) x1--,y1--;<br />
if(x1==CEN_X && y1<CEN_Y) x1--,y1++;<br />
if(x1<CEN_X && y1<CEN_Y) x1--,y1++;<br />
if(x1<CEN_X && y1==CEN_Y) x1++,y1++;<br />
if(x1<CEN_X && y1>CEN_Y) x1++,y1++;<br />
if(x1==CEN_X && y1>CEN_Y) x1++,y1--;<br />
if(x1>CEN_X && y1>CEN_Y) x1++,y1--;<br />
if(x1>CEN_X && y1==CEN_Y) x1--,y1--;<br />
<br />
//2nd Quadrant<br />
if(x2>CEN_X && y2<CEN_Y) x2--,y2--;<br />
if(x2==CEN_X && y2<CEN_Y) x2--,y2++;<br />
if(x2<CEN_X && y2<CEN_Y) x2--,y2++;<br />
if(x2<CEN_X && y2==CEN_Y) x2++,y2++;<br />
if(x2<CEN_X && y2>CEN_Y) x2++,y2++;<br />
if(x2==CEN_X && y2>CEN_Y) x2++,y2--;<br />
if(x2>CEN_X && y2>CEN_Y) x2++,y2--;<br />
if(x2>CEN_X && y2==CEN_Y) x2--,y2--;<br />
<br />
//3rd Quadrant<br />
if(x3>CEN_X && y3<CEN_Y) x3--,y3--;<br />
if(x3==CEN_X && y3<CEN_Y) x3--,y3++;<br />
if(x3<CEN_X && y3<CEN_Y) x3--,y3++;<br />
if(x3<CEN_X && y3==CEN_Y) x3++,y3++;<br />
if(x3<CEN_X && y3>CEN_Y) x3++,y3++;<br />
if(x3==CEN_X && y3>CEN_Y) x3++,y3--;<br />
if(x3>CEN_X && y3>CEN_Y) x3++,y3--;<br />
if(x3>CEN_X && y3==CEN_Y) x3--,y3--;<br />
<br />
//4th Quadrant<br />
if(x4>CEN_X && y4<CEN_Y) x4--,y4--;<br />
if(x4==CEN_X && y4<CEN_Y) x4--,y4++;<br />
if(x4<CEN_X && y4<CEN_Y) x4--,y4++;<br />
if(x4<CEN_X && y4==CEN_Y) x4++,y4++;<br />
if(x4<CEN_X && y4>CEN_Y) x4++,y4++;<br />
if(x4==CEN_X && y4>CEN_Y) x4++,y4--;<br />
if(x4>CEN_X && y4>CEN_Y) x4++,y4--;<br />
if(x4>CEN_X && y4==CEN_Y) x4--,y4--;<br />
}<br />
}<br />
int main()<br />
{<br />
int GD=DETECT,GM;<br />
<br />
Bline line1;<br />
initgraph(&GD,&GM,"c:/tc");<br />
<br />
//according to your own computer (TC\BIN) Directory<br />
<br />
<br />
line1.line1(5*MAGFY,7*MAGFY,1*MAGFY,3*MAGFY,3*MAGFY,1*MAGFY,7*MAGFY,5*MAGFY);<br />
<br />
getch();<br />
restorecrtmode();<br />
closegraph();<br />
return 0;<br />
}Upinder Singh Dhamihttp://www.blogger.com/profile/10526677796017634649noreply@blogger.com0