George Collins George Collins - 1 month ago 14
C Question

Making my first program

It's been about 6 months since I have done any programming. I took a module at university which taught me the basics of programming, xCode, C and C++, and led me to create me own (simple) program using terminal, and then a slightly less simple audio plugin. As such, I am familiar with C and C++ and googling to find my way around problems.

I now wish to get back into it only keep myself busy, and start off by creating simple programs to automate single tasks, and hopefully lead onto potentially making my own os x/windows based software. However, as all the tasks we were set on the module were fairly well guided by our tutor, I don't really know where to start in creating my first program.

My work place has given me task that would be useful if it were automated - simply (or not...) converting PDFs of manufacturers equipment stock with product codes and prices into a csv file that can then be imported into their own software. Now I would love to be able to in the future make this a proper OS-X app with GUI, but I assuming this might be a bit too ambitious for a first task? As such would it be best to make this a program run in terminal?

Specific to this problem, I googled for libraries that convert pdf to plain text and found Xpdf. I've downloaded the tools package, and tried running the pdftotext function in terminal, and it does as it says. But importing libraries is another thing I am a little unsure about, and I think I am right in saying that what I downloaded is already all compiled and so not something I would use in making my own program?

My overal question of this is - given what I already know (a reasonable bit of C/C++) and as you can see what I don't know, where should I start when coming to write my first program? Should I be going back a few steps and doing an online tutorial? or should I try and crack on, and perhaps someone on here could recap me on how to use a library, and maybe where to start on making a program with GUI.

Sorry if that was a long winded way of getting to the question...

Answer Source

Well if you have a program that you want to write, start there. Tutorials are definitely helpful if you don't feel comfortable, but eventually you have to leap from guided instructions to actually writing something new. That's when you'll really start learning.

So if you have something in mind, give it a go. You know C/C++? Well try with those languages. I'm a java guy, so most everything I write is in java, just because I'm so comfortable with it. From there, everything is just a series of steps that can be broken down into smaller and smaller problems until each one is solved.

Where to start you ask? Well first, outline the program. What functions do you want it to have? What constraints might you have? Hopefully you are starting with something simple. Once you have the program identified, think about the logic flow. Write down some pseudo-code on how you think the logic should work in order for the program to accomplish what you want it to. Then start at the beginning. Assuming you know the basic formatting for a C/C++ project to run, start with the first logical step. If you don't know the syntax, search around. Most likely whatever you are building at this point will have concepts already documented/asked about/solved thousands of times before. Repeat this process and eventually the program will start to come together and make more sense. You will learn a lot through the trial and error, and you will start to remember how to do certain things so that next time you are writing a program, you won't even need to look up how to do some things. That's when your programs can start to get more advanced.

Good luck, hope this helps!