C++ help please!! Take the broken c++ code, provided with this project, and repa
ID: 3819595 • Letter: C
Question
C++ help please!! Take the broken c++ code, provided with this project, and repair it. The line numbers listed here are for the unaltered original busted code. There are a couple of questions embedded in the code that you will answer with comments embedded in your repaired code at the point in the code where the questions are asked. Those questions are found at lines 194 and 247. There is a simple formula to be reverse engineered at line 142. Another is missing at line 158. Two simple equations with missing formulas are at lines 173 and 174. You will need to derive the math equation needed to change 2D x,y coordinates into the 1D string coordinate system at line 188. you will need to fill in the missing parameters located at lines 143, 144, 145, 161, 162 and 163. there are more missing parameters at line 177. You will recreate the missing control logic of the for loops located at lines 159, 176, 218, 225, 232 and 240. You will add the following gridable functions to the projects capabilities: cosine, tangent, reciprocal of x, parabola and the ellipse. The final required item of this project is, once your program is running, to successfully change the size of the grid through the provided menu system. Strings: These are the only string manipulators used in this project. Powerful member functions they are. create a string, g, that is int long filled with char characters string g(int,char) replace in the string g starting at position int a, take out int b number of chars, replace with int c number of characters, that are char characters. a b c g.replace(int,int,int,char) select a substring from g starting at position int a that is int b characters long. a b g.substr(int,int) Hint: If we were you, we would build a driver program to independently repair the functions grid_new and grid_show. What this means is that you would create a completely different program (main) in a completely different source file. Then cut and paste from the busted code the two busted functions back into your brand new driver program and go from there.
This is the broken code:
Explanation / Answer
#include #include #include using namespace std; // menu headers int menu_c(string&); int menu_e(int&, string&); int menu_g(string&); // function headers string grid_new(); void set_vars(int, int); void set_grid(string&); void grid_map(string&, int, int, char); void grid_map(string&, int, double, char); void grid_set_00 (string&, char); void grid_set_xax(string&, char); void grid_set_yax(string&, char); void grid_show(string&); void grid_res(string&); // gridable function headers // add additional gridable equation functionality here void eq_init(int, string&, bool, bool); void line_init(); void line_g(string&); void sin_init(); void sin_g(string&); // two sets of // global variables // for the grid int xmin= 0; int xmax= 0; int ymin= 0; int ymax= 0; // for the equations double a=1.0; double b=1.0; double c=1.0; string eq=""; // working portion of our project 2 starts here // don't mess with main() // // // int main() { set_vars(78, 24); // an X width by Y height grid string agrid = grid_new(); int doeq = 0; // active equation int doitem = 0; // flow control coutRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.