검색어 입력폼

Random Access File

저작시기 2009.05 |등록일 2010.04.05 파일확장자기타파일 (c) | 가격 2,700원

소개글

To create a database utility
RecNo, AcctNum, LastName, FirstName, Phone, Balance 목록이 포함된 데이터베이스 파일(*.dat)을 사용하며, 명령어를 입력 받아 명령을 수행하는 프로그램. 파일에 직접 접근하는 것이 특징.

Commands
use Filename, list, index, view, draw, insert,
delete , select , clear, close, quit

Pseudo Algorithm
The pseudocode below outlines the basic steps in this program:

BEGIN
REPEAT
Print "." as a prompt.
Read the next command from the keyboard.
Process this command.
UNTIL the 'quit' command is input.
END.



#include
#include
#include
#define TRUE 1
#define FALSE 0

typedef struct {
char acctnum[10];
char lname[15];
char fname[10];
char phone[13];
float balance;
int shouldDel;
} ACCOUNT;

typedef struct tnode {
int recno;
char key[10];
struct tnode *left;
struct tnode *right;
} TREE;

FILE *AcctDB;
TREE *root = NULL;
int fileopen = FALSE;
int indexed = FALSE;
char fieldname[10];

void build(char *argv[]);
void process_use(char fname[]);
void process_list();
void process_index(char fieldname[]);
void process_draw();
void process_view();
void process_delete(char key[]);
void process_insert();
.....


* output---
REC # ACCTNUM LASTNAME FIRSTNAME PHONE BALANCE
----- ------------- -------------- -------- ------------ --------
0 MK-2770 Moreland Karen 555-4390 495.33
1 SJ-3858 Sampson Julie 555-7270 1395.89
2 TD-2589 Thompson Donald 555-6430 23.42
3 BD-4200 Bowman Dave 555-2010 8321.84
4 CD-3190 Cole Darren 555-3644 0.00
5 AJ-2417 Anderson James 555-4700 46.83
6 RJ-5922 Roberts James 555-2433 62.93
.use
Specify a databse file name!
.use acct.dbf
.view
No Index active.
.list
------------------------------ List -----------------------------
REC # ACCTNUM LASTNAME FIRSTNAME PHONE BALANCE
----- ------------- -------------- -------- ------------ --------
0 : MK-2770 Moreland Karen 555-4390 495.33
1 : SJ-3858 Sampson Julie 555-7270 1395.89
2 : TD-2589 Thompson Donald 555-6430 23.42
3 : BD-4200 Bowman Dave 555-2010 8321.84
4 : CD-3190 Cole Darren 555-3644 0.00
5 : AJ-2417 Anderson James 555-4700 46.83
6 : RJ-5922 Roberts James 555-2433 62.93
.index firstname
Duplicate key found in record <6>.
7 records are indexed
....

컴파일 실행환경

microsoft visual c++ 6.0
다운로드 맨위로