Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ ASCII art Please help to write code. : : #include #include #include #include #include using namespace std; const int BUFFERSIZE = 20; const int

C++ ASCII art

Please help to write code.

:

image text in transcribed

:

#include #include #include #include #include using namespace std;

const int BUFFERSIZE = 20; const int FILENAMESIZE = 255; const int MAXROWS = 22; const int MAXCOLS = 80;

// ASCII codes for special keys; for editing const char ESC = 27; const char LEFTARROW = 75; const char UPARROW = 72; const char RIGHTARROW = 77; const char DOWNARROW = 80; const char SPECIAL = 224;

/* * Gets a filename from the user. If file can be opened for reading, * this function loads the file's contents into whiteboard. * File is a TXT file located in the SavedFiles folder. * If file cannot be opened, error message is displayed and * whiteboard is left unchanged. */ void loadWhiteboard(char whiteboard[][MAXCOLS]);

/* * Gets a filename from the user. If file can be opened for writing, * this function writes the whiteboard contents into the file. * File is a TXT file located in the SavedFiles folder. * If file cannot be opened, error message is displayed. */ void saveWhiteboard(char whiteboard[][MAXCOLS]);

/* * Initializes whiteboard to contain all spaces. */ void initWhiteboard(char whiteboard[][MAXCOLS]);

/* * Displays whiteboard contents on the screen, with a border * around the right and bottom edges. */ void displayWhiteboard(char whiteboard[][MAXCOLS]);

/* * Allows user to edit the whiteboard by moving the cursor around and * entering characters. Editing continues until the ESC key is pressed. */ void editWhiteboard(char whiteboard[][MAXCOLS]);

/* * Copies contents of the "from" whiteboard into the "to" whiteboard. */ void copyWhiteboard(char to[][MAXCOLS], char from[][MAXCOLS]);

/* * Replaces all instances of a character in the whiteboard. * oldCh is the character to be replaced. * newCh character is the character to replace with. */ void replace(char whiteboard[][MAXCOLS], char oldCh, char newCh);

/* * Shifts contents of the whiteboard by a specified number of rows and columns. * rowValue is the number of rows by which to shift * positive numbers shift downward; negative numbers shift upward * colValue is the number of rows by which to shift * positive numbers shift right; negative numbers shift left */ void moveWhiteboard(char whiteboard[][MAXCOLS], int rowValue, int colValue);

/* * Clears a line on the output screen, then resets the cursor back to the * beginning of this line. * lineNum is the line number on the output screen to clear * numOfChars is the number of characters to clear on this line */ void clearLine(int lineNum, int numOfChars);

/* * Moves the cursor in the output window to a specified row and column. * The next output produced by the program will begin at this position. */ void gotoxy(short row, short col);

int main() { char whiteboard[MAXROWS][MAXCOLS];

// Your code here:

return 0; }

void gotoxy(short row, short col) { COORD pos = { col, row }; SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos); }

void clearLine(int lineNum, int numOfChars) { // Move cursor to the beginning of the specified line on the console gotoxy(lineNum, 0);

// Write a specified number of spaces to overwrite characters for (int x = 0; x

// Move cursor back to the beginning of the line gotoxy(lineNum, 0); }

void replace(char whiteboard[][MAXCOLS], char oldCh, char newCh) { // Your code here: }

void editWhiteboard(char whiteboard[][MAXCOLS]) { char input; int row = 0, col = 0;

// Move cursor to row,col and then get // a single character from the keyboard gotoxy(row, col); input = _getch();

// Your code here: }

void moveWhiteboard(char whiteboard[][MAXCOLS], int rowValue, int colValue) { // Your code here: }

void initWhiteboard(char whiteboard[][MAXCOLS]) { // Your code here: }

void displayWhiteboard(char whiteboard[][MAXCOLS]) { // Clear the screen system("cls");

// Your code here: }

void copyWhiteboard(char to[][MAXCOLS], char from[][MAXCOLS]) { // Your code here: }

void saveWhiteboard(char whiteboard[][MAXCOLS]) { // Your code here: }

void loadWhiteboard(char whiteboard[][MAXCOLS]) { // Your code here: }

D: Downloads) KE>dit / ove / eplace / ndo / oad / ave / uit: D: Downloads) KE>dit / ove / eplace / ndo / oad / ave / uit

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Business Process Driven Database Design With Oracle PL SQL

Authors: Rajeev Kaula

1st Edition

1795532386, 978-1795532389

More Books

Students also viewed these Databases questions

Question

How do Excel Pivot Tables handle data from non OLAP databases?

Answered: 1 week ago