Not sure how to do this assignment the way it is asked

How do I use 2d char arrays to print a picture? Using these functions

In your main you should declare your 2D array: char picture[MAX_ARRAY][MAX_ARRAY];

void initialize_picture(char picture[MAX_ARRAY][MAX_ARRAY]); Uses a nested for loop to initialize the picture to all spaces

void print_picture(const char picture[MAX_ARRAY][MAX_ARRAY]); Uses a nested for loop to print the picture to the screen

void make_picture(char picture[MAX_ARRAY][MAX_ARRAY]); Uses a loop and allows the user to draw a picture. Should prompt for user action, and exit cleanly when they are done drawing

void paint_pixel(char picture[MAX_ARRAY][MAX_ARRAY], int row, int col, char pixel); Changes the value of the picture at row, col to pixel. This is where you should do your error checking. If the user enters incorrect row or column values, print an error and leave the picture unchanged for this iteration

void swap_all(char picture[MAX_ARRAY][MAX_ARRAY], char source, char target); Loops over the entire image, swapping all instances of the character source with the supplied character target. This allows a user to perform a blanket substitution over all characters of a given type.

It should also behave like this.
In a loop, your program should ask the user whether they want to draw, swap characters, or quit the program

When drawing: ask the user for a row, column, and character, and then store the character at the appropriate "pixel" (location in the 2D array)

When swapping characters: ask the user for an original and target characters - find all occurrences of the original character in your 2D array, and replace them with the target character

When quitting: print out the current picture one last time, and gracefully exit the program

Your program should keep looping and interacting with the user until they quit the program

Your program should verify that the user's input is correct (that the row and column are not less than 0 and not greater than your MAX_ARRAY constant

There is a sample user interaction here. This is a simplistic example, feel free to improve the interface as much as you want.
What especifically is confusing you?

From what I understand, the pictures are ASCII-art, not actual images.
Topic archived. No new replies allowed.