Can someone explain to me how to use argc and argv to make command line wait until the user will type something, and then do the code, call functions that I want to be called after the specific string like "-i" or "graph"?
Here's the code
int main(int argc, char* argv[]) {
bool printTree = false; // Flaga określająca, czy drzewo ma być wypisane
if (std::strcmp(argv[0], "-i") == 0) {
printTree = true;
return 0;
}
if (printTree) {
Wezel* korzen = nullptr;
for (int i = 1; i < argc; ++i) {
if (std::isdigit(argv[i][0])) {
int wartosc = std::stoi(argv[i]);
wstaw(korzen, wartosc);
}
}
std::cout << "Drzewo Red-Black:" << std::endl;
inorder(korzen);
}
return 0;
}