C++ is too hard

I am in my first class of C++. I feel like the teacher is asking us the impossible. We are 4 weeks in the class and we are given the N-queens puzzle.

I am really discouraged... I spent over 50h this week on the nQueens problem and I cannot get it to work... It's due in 48h.

Any tips for a discouraged beginner?
Last edited on
What aspects of C++ are most confusing, challenging, or tedious/time-consuming for you?
I started a Java course to see what the fuss was about. I'm also 4 weeks in. You know what kind of questions I am getting?

Write and run a Java program which allows the user to input a double and outputs the square of this number.

Wanna trade courses? (Though at least the answer needs to implement a GUI).
Last edited on
I feel like the teacher is asking us the impossible. We are 4 weeks in the class and he gives us the N-queens puzzle.

You use C++ after you learned it. And learning it has nothing to do with the N-queens puzzle.

It has everything to do with learning how the language works, and its quirks and pitfalls, being the process by which you become proficient and confident enough to actually begin using C++.

I guess many teachers want to push students to "get something done" that's not trivial, hence your assignment. Still, I think solving puzzles belongs in an algorithms and data structures class, not a C++ language class.

Not only that, but he restricts it to 4 different files of which 2 headers and 2 source files that contain private and public elements of a class, functions already restricting the programming to multidimensional vectors, etc.

Maybe you mean "multidimensional arrays"? If you're supposed to be using std::vector that would actually be a good thing.

Any tips for a discouraged beginner?

Post on these forums for help.
Consider it a "baptism by fire", OP. It may seem impossible now, but putting the effort in at the early stages will make it easier later on, and you'll be a better programmer for having been challenged from the outset.

Feel free to ask for help on the forums though.

For this project, you should read the Wikipedia article - https://en.wikipedia.org/wiki/Eight_queens_puzzle - it has a nice explanation of the problem and the algorithm that solves it (but don't be tempted to read or copy the sample program until you've at least attempted your own implementation). If you're not confident in your abilities to program with classes, try just getting something that works, and then convert it into a class afterwards. You probably only need one, so you'll probably only need one header file and one or two source files (depending on whether you like to put the main function in its own file).

A lot of the time, programming these days is really about reading. With the Internet, you have pretty much the entirety of human knowledge at your fingertips. Just don't be tempted to copy solutions off of the Internet, because that leads to sloppy programming. But you're not expected to derive solutions to these problems yourself -- at least, not four weeks into the course. In your second year and third years they will probably ask you to come up with your own algorithms for things, but by then you would have learned about algorithms in depth.

Catfish4 wrote:
Maybe you mean "multidimensional arrays"?

Maybe he means std::vector<std::vector<T>>.
Thanks for your input guys, its appreciated!

Last edited on
closed account (S6k9GNh0)
Hey, good on you! 99% of the users who discuss homework on here just ask for an answer and put very, very little effort into it themselves.

Although I'm a bit jealous. I've taken a course on C++ (don't recall the exact name of the class) but it was nowhere even close to being as exciting as what you claim. Rather, I finished the entire class assignments in just a week or two. Of course, I had issues with the tests due to really innacurate question answers but that's a different story...
n-queens has nothing to do with C++. It's just a tough problem to wrap your mind around if you haven't had the algorithms experience. It's a fun problem though.
I'm with you OP. My class is kicking my butt.
Topic archived. No new replies allowed.