Open Brahvim opened 1 year ago
In fact, check out this repository I built over the last ~20
+ hours, just for you!
Have a look at Main.cpp
and perhaps also Main.hpp
. You'll get an idea on how code should be organized for such programs. Putting all kinds of printing and input checking into separate functions of their own is very helpful to organize the code into loops.
Also, the program uses an extremely simple algorithm I wrote to do some string matching magic. Check it out on your nearest GNU-Linux machine!
Thanks a lot for ur suggestion but ... uh I did not understood the code i mean i am not sooo much good at c++ :( . all this went above my head :( all that i know in c++ i have used it in this prj so i know only this much in c++
Hello there! I suggest you to have a look at the following program. Run it, read its code, and see how you could replicate the same, "nice, readable"
stdout
output!Also, please do not use numbers to ask users for navigating menus! You might want to make use of actual words, and check if they are equal to a string without caring about the case. Put the entire query into a function so you can repeat it if the user enters something wrong. Also, do not perform checks on the input in the same function that also gives the user these options! Use another function for it. That way, you will be able to repeat certain tasks easily.
You might want to make functions to, say, print lists, simple lines, et cetera, then use those throughout the program along with separate functions to check the user's input. This will make things easier! Using function pointers here will give you extra convenience.
Feel free to ask me for example code doing this stuff!