233k views
4 votes
Write a program that will allow the user to type anything he/she wants. Letters, digits, special characters. In as many rows as he/she wants. The user then can save the text he/she wrote, then later on load it to continue working on. Your program should allow the user to do the following:

-Navigate the screen using the arrow keys (go up if there is text above the cursor and down if there is text below cursor, right if there is text on the right side of cursor and left if there is text on left side of cursor: linked list)
-Cursor can not go outside screen.
-User can save the document on disk in text format
-User can load item from a file into the editor. So if I have my own TEXT file, I can load it into your editor to read it and edit it
-User can manipulate text by adding, deleting, copy/pasting....etc.
-Display a menu with the options/commands the user can use to operate your editor

User Shparkison
by
7.7k points

1 Answer

3 votes

Answer:

See explaination for the program code.

Step-by-step explanation:

#include<conio.h>

#include<stdio.h>

#include<string.h>

#include<iostream.h>

class NotePad

{

private:

int x;

int y;

int key;

int total_chars;

int total_words;

int total_sentance;

int line[100];

public:

void clipboard()

x=1,y=1,total_words=0,total_chars=0;

int line_index=0;

while(key!=27)

{

gotoxy(1,50);cout<<"Col: "<<x<<" ";

gotoxy(11,50);cout<<"Rows: "<<y;

gotoxy(21,50);cout<<"Total Chars: "<<total_chars;

gotoxy(40,50);cout<<"Total Words: "<<total_words;

total_chars++;

gotoxy(x,y);

key=getch();

gotoxy(x,y);printf("%c",key);

if(key==13)

{

y++;

line[y]=x;

x=1;

}

else if(key==32)

{

total_words++;

}

else if(key==8)

{

x=line[y]-1;

gotoxy(x,y);cout<<" ";

}

else

{

x++;

}

}

}

};

void main(void)

{

clrscr();

NotePad np;

np.clipboard();

getch();

}

User Steo
by
7.7k points