I have a pretty simple C++ console program. It's working fine, but I have some issues. I have 2 functions. First function called "input" asks from user to input numbers from 6 to 10. In that function I declared:
if ((a[i][j] < 6) || (a[i][j] > 10))
{
cout<<"Invalid input!";
return 0;
}
Second function called "output", prints out those numbers from first function.
In the main it is like:
int main ()
{
...
input (matrix, number);
output (matrix, nubmer);
}
My question is this. When I input number that isn't 6-10, my program still do "output" function, so it prints some random numbers. How can I break whole program in exact time when input rules are broken? Without any random output and stuff, just to print "Invalid output", then to start program from the start?