daviddoria 334 Posting Virtuoso Featured Poster

Is this a homework problem or do you really just want to get the numbers sorted? If so, use std::sort from <algorithm>

daviddoria 334 Posting Virtuoso Featured Poster

I would very much suggest you hard code values into the program as you debug. Once you're convinced it's working, then you can add in the user input. This will also help us help you - it would be very complicated to explain exactly the sequence of input values you used - whereas if you could post compilable code that demonstrates the problem that would be much easier. However, even if you post compilable and run-albe code, it is unlikely that anyone is going to debug your 200 lines. You really should attempt to narrow the problem down so we can look at a specific function or something like that.

daviddoria 334 Posting Virtuoso Featured Poster

Have you tried stepping through the code with a debugger? Once you do that, if you are still stuck, I would try to narrow down the problem. It is unlikely anyone is going to look through your 200 lines of code. If you can hardcode values into the program to get it into the last state you think it is correct, then you can ask a much more direct question. However, if you prepare the question correctly it is likely you will find your own answer :)

daviddoria 334 Posting Virtuoso Featured Poster

Please explain what the comment "// dosent work" on the connect call means. Also, you should probably look at some qt examples:
http://programmingexamples.net/wiki/Qt

and then ask on qt forums: http://developer.qt.nokia.com/forums/

This Daniweb forum is for pure c++.

David

daviddoria 334 Posting Virtuoso Featured Poster

Please use code tags. It doesn't tell you which symbol is multiply defined?

daviddoria 334 Posting Virtuoso Featured Poster

Before messing around with a printBoard() function, you should make some examples for yourself to make sure you understand the basics. Create a string and output it. Does it look correct?

daviddoria 334 Posting Virtuoso Featured Poster

My suggestion is to first create a demo program where there is no user input (hardcode or remove anything that you can to still reproduce the problem). This way we all know exactly what the state of the program is when looking at your code.

David

daviddoria 334 Posting Virtuoso Featured Poster

That garbage value is most likely caused by an uninitialized variable.

Any time I see '**':

neuron** connections;

I cringe...

Have you considered using:

std::vector<std::vector<neuron> > connections;

instead?

daviddoria 334 Posting Virtuoso Featured Poster

Did you read the previous post? StuXYZ spent a lot of time explaining it for you!

// Test to see if all possibilities for have been used. You don't need to test beyond sqrt(i).

daviddoria 334 Posting Virtuoso Featured Poster

Welcome to Daniweb!

First, please use code tags around your code, it makes it much easier for us to read. Second, I STRONGLY recommend that you use std::vector instead of c-style arrays. It will save you hours of headaches for sure.

Good luck,

Dave

daviddoria 334 Posting Virtuoso Featured Poster

(Sorry, double post)

daviddoria 334 Posting Virtuoso Featured Poster

This is another one of those "common" questions that I am recommending cataloging:

http://daniweb.uservoice.com/forums/62155-general/suggestions/830529-create-a-wiki-to-catalog-answers-and-examples-?ref=title

Please vote for it!

Dave

iamthwee commented: No -2
daviddoria 334 Posting Virtuoso Featured Poster

You should see if there is an XML parser library for c++. This is pretty much exactly the idea of XML. Otherwise, just read in line by line, check for '[', then keep reading all of the lines until you hit another '['.

daviddoria 334 Posting Virtuoso Featured Poster

Please try to pose your question in a concise form such that it can benefit others in the future. That is, ask a question about c++, not about your program.

Some recommended reading...
http://daviddoria.blogspot.com/2010/05/problem-abstraction-helping-others-help.html

Dave

daviddoria 334 Posting Virtuoso Featured Poster

You're going to have to show some effort before anyone is going to help you with your project. Have you written any code so far? I'm not sure how they're expecting you to know the form/shape of the letters - do you have any additional input files? (b/w images of letters, etc)?

Dave

Laurentius Dion commented: not bad +0
daviddoria 334 Posting Virtuoso Featured Poster

Why not try the easy way to read files?

ifstream fin(Filename.c_str());

	if(fin == NULL)
		cout << "Cannot open file." << endl;

	vector<string> Lines;
	string line;
	
	while(getline(fin, line))
	{
		Lines.push_back(line);
	}
	
cout << "NumLines: " << Lines.size() << endl;

	for(unsigned int i = 0; i < Lines.size(); i++)
		cout << Lines[i] << endl;