D
Deleted member 205
Guest
Awesome. Great work for a small Project to practice C++.
While I am not a C++ Programmer, I can offer some advice for improving the Style of your Code and making it more readable.
First of, is putting a line between your Headers and your
Instead of this:
Also, I've noticed big empty gaps in the code. This is around lines 91 and 99, which also contain a Note in the middle. I would discourage from having massive gaps as it just doesn't look right and it means that people need to scroll more when reviewing your Code.
Also, maybe start separating Loops and Conditions. Look at this bit:
The While-Loop and the If-Statement do not have an empty line in between them. While there is a brace in the middle of them, it's still better to have an empty line between that If-Statement and that ending-brace.
Also, I've found that your If-Statements and Loops start getting deeply nested and even found a Comment that reaches 200-Columns. First of all, try to avoid nesting your Code so deep. While the nesting isn't bad and doesn't cause an issue, it can if you continue to nest deeper. So, remember that.
As for that Comment that reaches 200-Columns, try to stop your lines from reaching that length. A lot of Coding-Styles advise you or maybe even require you to have your Line-Length at 80, 100, 120 etc. And they usually don't go beyond 120 Columns. Avoid long lines because what happens if a Developer like yourself is working using a vertical-monitor? That one line will end up going off the screen which can be annoying as you don't want your Code going out of view.
This is all of the advice that I can offer for helping to make your Code more readable and better. Take it and it can prove beneficial to writing good Code.
While I am not a C++ Programmer, I can offer some advice for improving the Style of your Code and making it more readable.
First of, is putting a line between your Headers and your
main()
Function. What I mean is this:
Code:
#include <iostream>
#include <stdlib.h>
#include "func.h"
int main()
Code:
#include <iostream>
#include <stdlib.h>
#include "func.h"
int main()
Also, I've noticed big empty gaps in the code. This is around lines 91 and 99, which also contain a Note in the middle. I would discourage from having massive gaps as it just doesn't look right and it means that people need to scroll more when reviewing your Code.
Also, maybe start separating Loops and Conditions. Look at this bit:
Code:
while (std::cin.fail())
{
std::cout << "Input Y or N" << std::endl;
std::cin.clear();
std::cin.ignore(256, '\n');
std::cin >> operation_Switch_Setting;
}
if (operation_Switch_Setting == "Y" || operation_Switch_Setting == "y") //checks for yes option
{
std::cout << "+ for add, - for subtract, * for multiply, / for divide, and % for modulus. Type one to choose operator" << std::endl;
std::cin >> operation_Setting;
if (operation_Setting == "+") // Way too many if checks, maybe could be shortened
{
std::cout << "Give another number to add to your previous result, " << past_Output << ":" << std::endl;
std::cin >> after_Num;
present_Output = add(past_Output, after_Num);
std::cout << present_Output << std::endl;
didOneOperation = true;
past_Output = present_Output;
present_Output = 0;
}
Also, I've found that your If-Statements and Loops start getting deeply nested and even found a Comment that reaches 200-Columns. First of all, try to avoid nesting your Code so deep. While the nesting isn't bad and doesn't cause an issue, it can if you continue to nest deeper. So, remember that.
As for that Comment that reaches 200-Columns, try to stop your lines from reaching that length. A lot of Coding-Styles advise you or maybe even require you to have your Line-Length at 80, 100, 120 etc. And they usually don't go beyond 120 Columns. Avoid long lines because what happens if a Developer like yourself is working using a vertical-monitor? That one line will end up going off the screen which can be annoying as you don't want your Code going out of view.
This is all of the advice that I can offer for helping to make your Code more readable and better. Take it and it can prove beneficial to writing good Code.
Well, you're actually the 250th Member, so congrats.wboycher said:Also how many people are on this forum? Just wondering.