Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For the final project, you are required to submit a zip file named ` paint . zip ` containing at least three ` . c

For the final project, you are required to submit a zip file named `paint.zip` containing at least three `.c` files and two `.h` files, along with a `Makefile` to compile everything into an executable named `paint.out`. The project involves implementing a text-based version of paint, focusing on various topics covered in class, excluding recursion. The program heavily emphasizes the use of pointers and `realloc`.
The program's overview involves displaying the current canvas, allowing the user to enter commands, and executing those commands until the user enters a quit command. The program should accept up to two command-line parameters indicating the number of rows and columns in the starting canvas. If no parameters are given, an incorrect number of arguments is provided, or invalid values are entered, the canvas defaults to a 10x10 size.
User commands, entered via standard input, include:
-`quit`: Ceases program execution and frees dynamically allocated memory.
-`help`: Displays help information using a predefined function in `print_statements.c`.
-`write start_row start_column end_row end_column`: Draws lines based on specified coordinates and characters.
-`erase row col`: Erases the character at the specified row and column.
-`resize num_rows num_cols`: Resizes the canvas to the specified dimensions.
-`add [r | c] position`: Adds a new row or column at the specified position.
-`delete [r | c] position`: Deletes a row or column at the specified position.
-`save file_name`: Saves the current canvas to a file.
-`load file_name`: Loads a canvas from a specified file.
Assumptions include handling invalid input by prompting the user for a new command until valid input is received. New requirements include using at least one struct meaningfully and organizing the solution into three `.c` files and two `.h` files. Breaking these requirements results in a zero on the assignment.
The program must have comments at the top describing its functionality and comments for each function, explaining their purpose and parameter meanings. A minimum of 12 user-defined functions is required, and the use of global variables is prohibited. Example sample_run
./paint.out
9**********
8**********
7**********
6**********
5**********
4**********
3**********
2**********
1**********
0**********
0123456789
Enter your command: w 0099
9*********/
8********/*
7*******/**
6******/***
5*****/****
4****/*****
3***/******
2**/*******
1*/********
0/*********
0123456789
Enter your command: w 9009
9\********/
8*\******/*
7**\****/**
6***\**/***
5****\/****
4****/\****
3***/**\***
2**/****\**
1*/******\*
0/********\
0123456789
Enter your command: w 4244
9\********/
8*\******/*
7**\****/**
6***\**/***
5****\/****
4**--+\****
3***/**\***
2**/****\**
1*/******\*
0/********\
0123456789
Enter your command: w 4641
9\********/
8*\******/*
7**\****/**
6***\**/***
5****\/****
4*---++-***
3***/**\***
2**/****\**
1*/******\*
0/********\
0123456789
Enter your command: w 8606
9\********/
8*\****|*/*
7**\***|/**
6***\**+***
5****\/|***
4*---+++***
3***/**+*<

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

Students also viewed these Databases questions