Help me please Eight rains problem C/C++

The object of the eight rows problem is to place eight rows of chess on the chessboard.
8 x 8 squares without the rains being able to threaten each other, according to the rules
Chess (the color of the pieces being discarded). Therefore, it should not rain two
Never share the same row, column or diagonal.

Propose an adequate solution to this problem.

This sounds like homework. I’m not sure if you’ll find somebody here in this forum who will do your assignments for you. And you will definitely learn more if you try to solve the problem yourself.
But the good people here might probably be able to help if you have concrete questions or problems. Show us what you got so far. Do you have a problem with the algorithm? What did you try? Or is this more a problem of how to translate the algorithm into code? If you get an error or a specific problem, show us the code and describe what it’s supposed to do.

That being said: This is a classic problem, called the Eight Queens Puzzle. It can be tackled in several different ways, for example with recursion, or by checking permutations of the numbers 0 to 7, or with genetic programming.

Oh, and one more thing: Many C or C++ programmers don’t like the term “C/C++”. Those are two different programming languages. Sure, they share some common core, but idiomatic code in one language is often terrible code in the other language. I’ve heard from interviewers that they use this term “C/C++” to filter out candidates because whoever uses it is probably not good in any of the two languages.

3 Likes

Thank you bro :heart_eyes: :heart_eyes: :heart_eyes: :heart_eyes: :heart_eyes: :heart_eyes: :heart_eyes: :heart_eyes: :heart_eyes: