Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 14

FACULTY OF ELECTRICAL

AND ELECTRONIC ENGINEERING


2020 – 2021
-------*-------

Project: Data structure and algorithms


Topic 5
ECE391: Computer System Engineering

Instructor: Dr. Truong Quang Vinh


Students: Nguyen Vinh Hung 1751044
Nguyen Duc Thang 1713236
Nguyen Anh Tuan 1751108

Ho Chi Minh City, 12/2020


Contents
I. Topic requirements............................................................................................................................2
II. Program operation............................................................................................................................3
1. Basic structure...............................................................................................................................3
2. Results............................................................................................................................................4
a. Start the program.........................................................................................................................4
b. Left, right.....................................................................................................................................5
c. Delete...........................................................................................................................................6
d. Insert............................................................................................................................................7
e. Load previous sting......................................................................................................................8
III. Program source code.....................................................................................................................9
1. Library, function and variable declaration.................................................................................9
2. Main() function..............................................................................................................................9
3. Input() function............................................................................................................................10
4. Kb() function................................................................................................................................10
5. Read() function............................................................................................................................11
6. Print() function............................................................................................................................12
7. Move() function............................................................................................................................13

1
1.Topic requirements
“Write a simple text editor using the list ADT (Problem P-6.3, Textbook, page 266).”

2. Program operation
1. Basic structure

2
2. Results
a. Start the program
- Before input

3
- After input string :”bachkhoahochiminh”

b. Left, right
- Before operation

4
- After press right arrow key:

-After press left arrow key :

5
c. Delete
- Before operation( cursor position at the last character)

- After operation ( we deleted “hochiminh” from the previous sting)

6
d. Insert
- Before operation

- After operation (we inserted “hochiminh2020”)

7
e. Load previous sting
- Before operation

- After operation

8
3. Program source code
1. Library, function, and variable declaration

2. Main() function

9
3. Input() function

- The function ask for the users ‘s desired operation and implement it right
after recieve the input. In the case the input is invalid, the program will ask
them to input it again.

10
- In the third operation, the random file is input from the user so that we
have to check whether the program can open that file or not. If not, an
announcement will be displayed and user will have to input it again. The
variable “o” is use for this purpose while o = 0 mean no file are currently
opened and o = 1 mean a file is opened.

4. Kb() function

5. Read() function

6. Print() function

11
7. Move() function

8. Insert() function

12
9. Del() function

10. Save() function

13

You might also like