can anyone please please give the flowchart of the following code?

amlan. m

New member
include <stdio.h>
#include <conio.h>
#include <string.h>
#include <process.h>
#include <ctype.h>
#include <dos.h>
#include <dir.h>
#include <fstream.h>


// CLASS HAVING THE RECORD OF CUSTOMER
class customer
{
char ph[10];
char name[30];
char add[40];
char type;
public :
void append();
void display();
void deleter();
void modify();
void list();
void help();
}cust;
void message(char mess[80])
{
int l,d;
l=strlen(mess);
d=l/2;
gotoxy(2,24);
textcolor(WHITE+BLINK);
textbackground(BLACK);
cprintf(" ");
gotoxy(40-d,24);
clreol();
cprintf("%s",mess);
textcolor(BLACK);
textbackground(WHITE);
}


// MAIN FUNCTION HAVING THE MAIN MENU

void main()
{
textcolor(BLACK);
textbackground(WHITE);
char ch,ch1;
while(1)
{
clrscr();
textcolor(WHITE);
textbackground(BLACK);
gotoxy(25,5);
cprintf("SAMBALPUR TELEPHONE OPERATOR LTD.");
textcolor(BLACK);
textbackground(WHITE);
gotoxy(25,8);
cout<<" D - Display a Bill";
gotoxy(25,10);
cout<<" L - List of customers";
gotoxy(25,12);
cout<<" H - Help";
gotoxy(25,14);
cout<<" M - Modify a record";
gotoxy(25,16);
cout<<" Q - Quit";
message("Select your choice");
gotoxy(40,18);
ch =getch();
ch = toupper(ch);
switch(ch)
{
case ('Q') : textcolor(WHITE);
textbackground(BLACK);
clrscr();
exit(1);
case ('D') : cust.display();
break;
case ('L') : cust.list();
break;
case ('H') : cust.help();
break;
case ('M') :
ch1 = 'A' ;
while(ch1 != 'Q')
{
clrscr();
textcolor(WHITE);
textbackground(BLACK);
gotoxy(25,5);
cprintf("MAHANAGAR TELEPHONE NIGAM LTD.");
textcolor(BLACK);
textbackground(WHITE);
gotoxy(25,9);
cout<<" A - Append a record";
gotoxy(25,11);
cout<<" D - Delete a record";
gotoxy(25,13);
cout<<" M - Change a record";
gotoxy(25,15);
cout<<" Q - Quit";
message("Select your option");
ch1 = getch();
ch1 = toupper(ch1);
switch(ch1)
{
case ('A') : cust.append();
break;
case ('D') : cust.deleter();
break;
case ('M') : cust.modify();
break;
}
}

}
}
}


void customer :: append()
{
char choice;
fstream fp;
fp.open("tphone.dat", ios::app);
if (!fp)
{
cout<<"Unable to open FILE.";
getch();
return;
}
while(1)
{
clrscr();
gotoxy(3,3);
cout<<"Customer Record #";
message("Enter the customer record");
while(1)
{
message("Enter the name");
gotoxy(3,5);
cout<<"Name : ";
gotoxy(25,5);
gets(name);
if(strlen(name)==0)
{
gotoxy(2,23);
clreol();
textcolor(WHITE+BLINK);
textbackground(BLACK);
cprintf("Name cannot
 
Back
Top