Question
C++ PROGRAM: I ONLY WANT HINTS, ADVICE SUGGESTIONS, AND POSITIVE FEEDBACK. I do know that I have to include an int main function that contains
C++ PROGRAM: I ONLY WANT HINTS, ADVICE SUGGESTIONS, AND POSITIVE FEEDBACK.
I do know that I have to include an int main function that contains two parameters an int and a pointer to character. However, I do nit understand what else is there for me to do if the provided.cpp files already has the ReadFont void function which reads in the width & height for every character in the file.
To create an ASCII font art message, your program will expect 5 command line arguments. The first argument is the string display. The second is the filename containing the bitmap font that will be used to render each character of the message in large format. The third argument is the message, a string of one or more characters. The fourth argument is a character that is to be used as the foreground (the letters). And the fifth argument is a character that will be used as the background for the ASCII font art. To create the output above, your program will be called with this command line: ./ascii_font_art.out display simple_font.txt Hello\ World! @ . Note that the backslash is used to include a space in the message (without it the program would see 6 command line arguments). You may also use single or double " quotes to delimit the message or when using special foreground and background characters (see the next example below). The program will output the ASCII font art message to the terminal (to std::cout). Alternatively, you can use command line file re-direction to send std::cout to a file: ./ascii_font_art.out display simple_font.txt 'Hello World!' '*' " " > hello_world_output2.txt You must exactly follow the specifications for the command line and output to ensure you receive full credit for your work.
#include #include #include #include #include #include #include #include // ====================================================================================== // Helper function to read the provided font from a file. The format // of the font file is described in comments below. The width, // height, and bitmap_letters variables are set by this function. void ReadFont(const std::string &font_file, int &width, int &height, std::vector > &bitmap_letters) { // open the font file for reading std::ifstream istr(font_file.c_str()); if (!istr) { std::cerr > width >> height; assert (width >= 1); assert (height >= 1); // Create a vector to store all 256 ASCII characters of the // characters. Each character is represented as a vector of // strings that are each wide. Initially the // characters are unknown (represented with the '?' character). bitmap_letters = std::vector > ( 256, std::vector ( height, std::string(width, '?'))); // read in all the characters // first is the ascii integer representation of the character int ascii; while (istr >> ascii) { assert (ascii >= 0 && ascii > c; assert (c == '\''); // use std::noskipws to make sure we can read the space character correctly istr >> std::noskipws >> c; // verify that the ascii code matches the character assert (c == (char)ascii); // switch back to std::skipws mode istr >> std::skipws >> c; assert (c == '\''); // read in the letter std::vector bitmap; std::string tmp; for (int i = 0; i > tmp; assert ((int)tmp.size() == width); // make sure the letter uses only '#' and '.' characters for (unsigned int j = 0; j 9 www.cs.rpi.edu/aca 1 mail.google.com | www.cs.rpi.edu/academics/courses/fall17/cscil 200/hw/01-ascii-font.-art/sentence.txt a 0 ) @ @ Apps Bookmarks y Graduate Progr Application Hom Online Applicati M Physics & Astro D users.aims.ac.za a Analytical Mech ( Ph.D. Program i 9 www.cs.rpi.edu/aca 1 mail.google.com | www.cs.rpi.edu/academics/courses/fall17/cscil 200/hw/01-ascii-font.-art/sentence.txt a 0 ) @ @ Apps Bookmarks y Graduate Progr Application Hom Online Applicati M Physics & Astro D users.aims.ac.za a Analytical Mech ( Ph.D. Program
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started