I heard from a friend of mine of the eight queens problem and I write a program to find all solutions to it. My problem is that it doesn't find any solutions and Wikipedia says there must be 92...
Type: Posts; User: Wicket
I heard from a friend of mine of the eight queens problem and I write a program to find all solutions to it. My problem is that it doesn't find any solutions and Wikipedia says there must be 92...
A yes. You're right. I always want to swap that to around. In a more normal for-statement I always see it directly that that's wrong. In this case I looked after the crash to that statement and...
I now || means or. Else I will have the problem that the statement will be false if I get i = 6 and j = 10. It must stop before it gets there. So it needs an or.
I have got this four for-statements in a program of mine:
for (int i = a + 1, j = b + 1; i < 8 || j < 8; i++, j++)
{
field[i][j] = -1;
filled++;
cout << i << ' ' << j << endl; // Just...
Thanks for the information.
If got a problem for reading multiple data types to a file using operator>> and getline.
Let say I've got the following code:
#include <iostream>
#include <string>
#include <fstream>...
At last, it is working.
Thanks everyone, not only for the functions to get working but also to understand some more things.
And how must I fix it, or is there a easier way to write and read wstrings and strings to a file?
Must I use operator<< and operator>>?
What do you mean that I am writing outside my memory. I can't see it in the code. After len++ I allocate memory: len-1 for all tokens and the last one for '\0'. I don't see that I am writing '\0' in...
Yes, the functions are working good and I am understanding it better. There is something in testfile.dat.
I have only the problem left that the program doesn't crash if I remove the line wcout <<...
1. len is the number of wchar's. I have replaced wfin.read(str_w, len) by wfin.read(str_w, len*sizeof(wchar_t)); and the same for wfout.read(...);
2. This will not fail because there is a statement...
Maybe it is because of my bad English but I don't still understand how I must solve the problem and I don't understand the problem itself very well (why does the write function for the normal string...
I am having problem to write a wstring to a file. I have made functions to write and read strings and wstrings but for a reason the I don't know it doesn't work for wstrings.
Here is my header
...