Alright, so my program is ready to go, but I have one error that pops up when compiling. It compiles successfully, but this error is causing my program to crash.
Your for loop is trying to call a function with out passing it arguments. Why are you calling the function there by the way? It's potentially very clever, but do you understand it?
I understand what it does, however, I don't understand what the issue seems to be.
At the risk of sounding like an idiot, why is it potentially clever?
Do you mind clarifying what you mean by my function not passing any arguments? I'm fairly new to all this, but this is stumping me. Seems like it should work.
To be honest, I only called the function there to see if it would fix the error...
You need to give it a parameter list. For instance, you would not simply call cin.get, you would actually add a parameter list, even if it is empty: cin.get().
The problem in your code is that you call the alpha function but you don't give it any parameters. You need to call it like this: alpha("string on the left", "string on the right") because you specify in the function definition that it takes two string parameters. Obviously you'd replace the strings above with actual string objects, like alpha(LeftString, RightString) or however your program works.
I said that it was potentially very clever because that section of the for loop is executed after the 'body'. Most people use it to increament or decreament a counter, but by putting a function there you could use it to do any number of things. That is if you actually understood what you are doing, and even though you say you do this line here:
To be honest, I only called the function there to see if it would fix the error...
Alright, so I guess I'm not understanding you correctly. But let me clarify a bit more for your sake.
Even when I don't call the Bool function before the sort and FOR loop, it gives me the same error for the FOR loop. Written as:
Sorry, I didn't realise he was using the std::sort function...I saw a line of code that wasn't indented correctly and I though it was a function definition...
@ L B: "sort(...)" can take three parameters, it's true that in this case it's a redundent but it wouldn't cause a compile error.
@ OP: I was refering to the call to "alpha(...)" inside your for loop. The third argument in your for loop, where you have "alpha" written with no parameters how did you manage to misunderstand me?
Alright, I understand now. I thought you were referring to either the function definition. Thanks for clearing that up.
I'll mark as solved if it works, otherwise, I'LL BE BOCK! lol
Thanks again.
**EDIT**
Alright, so the error is gone, but I must be doing something wrong because the program crashes and even though it compiles correctly, when I adjusted the argument, they have red lines under them like I did it wrong.
@ OP: Because "left" and "right" are not declared yet in that scope, they don't pass any real data to the function. Also now that I reread this what you're doing on Line 38 is useless as well, do you have much experiance using functions?