Closed npsark closed 9 years ago
I suspect this will be a really hard topic to make interesting and fun, but if you think you can do it that's fine. You should probably discus ANSI color codes as well.
sounds good, thanks
This is my rough draft at this point. I have a bit more to add and still have to polish but most of the content is there. https://github.com/npsark/rshell/blob/master/hw4.md
Hi @mikeizbicki , I rewrote my hw4 draft so that it matches the topic you approved instead of the ls formatting topic. If you can give it a read and let me know how it sounds, that would be greatly appreciated. It is still a bit short, but I want to make sure I'm headed in the right direction before I go on. Here's the link: https://github.com/npsark/rshell/blob/master/hw4REDO.md Thanks
This is looking great! I have three comments:
(1) You have a lot of fluff words that could be taken out and make it read faster.
(2) Replace:
cout << setbase(16) << 26 << endl;
cout << setbase(10) << 26 << endl;
cout << setbase(8) << 26 << endl;
//output:
//1a
//26
//32
with something more like:
code:
cout << setbase(16) << 26 << endl;
cout << setbase(10) << 26 << endl;
cout << setbase(8) << 26 << endl;
output:
1a
26
32
You could mention bitwise operations as an example of usefulness. File permissions are stored as an int, but they're much easier to interpret in octal than decimal.
(3) You should include the actual ansi codes for all the colors and effects in your writeup. I would make them variables, something like:
char *red = "\133[21";
char *blue = "\133[22";
char *green = "\133[23";
char *resetcolor = "\133[50"
then you can do examples like:
cout << red << "hello " << blue << "world" << resetcolor << endl;
You could also make functions like:
string mkRed(string &s) { return red + s + resetcolor }
and do
cout << mkRed ("hello") << mkBlue("world") << endl;
You should include a .h file in your submission that has all of these variables/functions to make it easy to include in other projects.
Thanks for the feedback!
I'm thinking, based on hw1 that a tutorial on output formatting using iomanip and cout might be useful. Would this be an acceptable topic?