Help, C/C++ Programming

Deliverables: you are required to upload your c code in the assignment dropbox set in Moodle. You are supposed to work with Linux gcc compiler and pico editor for compiling via the command line in the Linux terminal. In the beginning, you can use Dev C++ or Eclipse IDE - CodeBlocks since your Linux server is being setup. Note that c programming has a filename.c extension (not .cpp). You should make a directory called "Assignment_1" in your ''home'' directory of you Linux server account. In this directory, you can have your c code and accompanying files. Note that the code in your Linux server will be graded in your lab from your presentation.


In this assignment, you will have the opportunity to write a simple text processing program with all essential functions (open and save text documents, insert and delete text, search for words). A MENU will be used that will help users perform these operations. We assume that text read from a file is stored in an array until the file is saved.

You are required to use the c programming language (not C++) and use the std library functions or write the function yourself that implements operations/features of a simple text editor.

Note that all these functions will be implemented in one c program file.

Programming Requirements

a. Write a C program to open and close a file given its name. Your program must check whether or not the file exists.

b. Add a function for reading an opened file into an array of characters. You may assume the array is large enough to hold an entire file (e.g. 100,000 characters).

c. Add a function for saving the text stored in an array to a file. Your program must check whether or not the output file already exists, and if it does, your program must ask the user whether he/she wishes to overwrite the file.

d. Extend your program to count the number of words and characters in the text file. An algorithm for counting words is given in the textbook.

e. Add a function for inserting a string into the array. Insertion is done by providing a start position and a string

f. Add a function for deleting strings from the array. Deletion is done by providing a start position and the length of the string to be deleted.

g. Add a function that searches the text for a pattern. Show all occurrences of a string.

h. Add a function to replace all occurrences of a string with a new string. Note that this operation is a combination of search, delete, and insert operations.

Once all the functions have been implemented, you should design a menu that is used for informing users about selection. "Pico" text editor in Linux is a good example.

Extra Credit Problem:

i. Extend your program to allow all operations performed since the last save to be undone in the reverse order in which they were executed. For instance, a command''d 3 4'' which deleted the string "abcd" from position 3 is undone by a command ''i 3 abcd'' which will insert the string "abcd" at position 3. You will need a stack to save the undo operations that may be performed.
Posted Date: 3/8/2013 4:00:09 PM | Location : Fiji

Related Discussions:- Help, Assignment Help, Ask Question on Help, Get Answer, Expert's Help, Help Discussions

Write discussion on Help
Your posts are moderated
Related Questions
Project Description: I would like to be building regarding a complex mobile application build as we require the signing of an NDA. My firm in based in Montreal Canada and we are

Problem : Compiler Design - Limit the methods Rahul is a newbie to the programming and while learning the programming language he came to know the following rules: ·

Verifone pos offline mod vx670 Project Description: I want a programmer who will build custom application for Offline VX670 to collect and save info+pin 1) Press the am

.Develop a two dimensional interactive game with the following features: 1. Use OpenGL (any version you find convenient) 2. The game can either be two player or one player with the

Explain the  bit fields portable or not? - No, Bit fields aren't portable. - As Bit fields can't span machine words and number of bits in a machine word is different on diff

C Program to Check  EVEN & ODD NO   main() {           int n, a;           clrscr();           printf("ENTER ANY NUMBER: ");           scanf("%d", &n);

Smugglers are becoming very smart day by day. Now they have developed a new technique of sending their messages from one smuggler to another. In their new technology, they are send

A string S is said to be "Super ASCII", if it contains the character frequency equal to their ascii values. String will contain only lower case alphabets (''a''-''z'') and the asci

Polymorphism C++ supports this idea - that different objects do "the right thing "- by function polymorphism and class polymorphism. Poly means many, while morph means form.