It sounds like the prof wants a particular coding style. Ask him/her what that style is. Consider tools like astyle or GNU indent to automatically reformat your code into the desired style. The first thing I do when debugging code from this forum is reformat it using "indent" into the style that I'm accustomed to.
In fact, I'd argue that the prof should do the same: if he/she doesn't like the format then he should reformat to his liking, not you. Here in the real world, that's what I'd tell anyone who didn't like my coding style.
Nothing gets a flame war going like debates on coding style. It all boils down to a few things:
- The style is designed to make the code readable and maintainable.
- Be consistent
- Comment your code
- The indentation should reflect the actual block structure.
Your style is fine except perhaps for the 4th point. For example, I think this:
1 2 3 4 5
|
if(argc >= 4){
pivote = std::stoi(argv[3]);
}else{
std::cout << "El pivote toma el valor 0." << std::endl;
}
|
should be like this:
1 2 3 4 5
|
if(argc >= 4){
pivote = std::stoi(argv[3]);
}else{
std::cout << "El pivote toma el valor 0." << std::endl;
}
|
or, if you want to keep the brace lined up with the code, perhaps:
1 2 3 4 5 6
|
if(argc >= 4){
pivote = std::stoi(argv[3]);
}
else{
std::cout << "El pivote toma el valor 0." << std::endl;
}
|
The point is that the code under the
if
and the code under the
else
should be indented to the same level.