learn to indent.
> warning: control reaches end of non-void function
don't remove the context. `In function ‘bool checkDigits(std::__cxx11::string)’:'
now look at that function properly indented
1 2 3 4 5 6 7 8 9 10 11
|
// Check if any non-digit numbers in string
bool checkDigits(string check) {
for(int unsigned i = 0; i < check.length();) {
if(isdigit(check[i])) {
i++;
} else {
return false;
}
return true;
}
}
|
note how `return true' is
inside the loop, so you only will end up checking the first character.
About the warning, if the string is empty, ¿what would be the return value?
Also, your logic seems quite obfuscated
1 2 3 4 5 6 7
|
// Check if any non-digit numbers characters in string
bool checkDigits(string check) {
for(int unsigned K = 0; K < check.length(); ++K)
if(not isdigit(check[K]))
return false;
return true;
}
|
1 2
|
infile.open(argv[1]);
outfile.open(argv[1]);
|
¿are you sure that you want to overwrite the input file?
> it shows a pop up saying it's stopped working and exits the program. I'm not
> sure where to actually start to fix it and get myself on track.
run through a debugger, it will point you to the line where it crashes.
valgrind may help to detect invalid access of your strings.