Hi!

I'm new in C++, but perhaps this is a general problem, not C++ exclusive.

This is printed in my console, "-1.#IND", when using a printf, when this occurs?

thanks

Hi!

I'm new in C++, but perhaps this is a general problem, not C++ exclusive.

This is printed in my console, "-1.#IND", when using a printf, when this occurs?

thanks

might be that you passed printf() an uninitialized variable, but since I forgot my crystle ball today nor am I a mind reader, you will have to post your program.

might be that you passed printf() an uninitialized variable, but since I forgot my crystle ball today nor am I a mind reader, you will have to post your program.

I asked when generally this occurs...

My code is extense to post here :p

Can I send you by mail?

and where to?

>>I asked when generally this occurs..

And I answered it.

you can zip it up and attach it to your post. Better still -- create a very small program that contains the offending line of code to see if you can duplicate the problem. If you can and still don't know what is wrong then post that example program.

you can zip it up and attach it to your post. Better still -- create a very small program that contains the offending line of code to see if you can duplicate the problem. If you can and still don't know what is wrong then post that example program.

here it is my program files...

I have 2 classes:
-CMatrix -> Matrix.cpp and Matrix.h
-CLayer -> Layer.cpp and Layer.h

main -> IUCUNN.cpp, IUCUNN.h

stdfax.cpp and stdfax.h

regards

What compiler did you use??? I compiled it with Dev-C++ and below is the output. Is that what you expect? The only thing I changed was replace <iostream.h> with <iostream> because iostream.h is obsolete (deprecated, I think that's how its spelled)

[edit]And changed const dim = 48; to const int dim = 48; [/edit]

D:\tmp\IUCUNN_08_mar>Project1
Training...
Initiating Layer 1... Done.
Initiating Layer 2... Done.
Initiating Layer 3... Done.

epochs: 0

epochs: 1

epochs: 2

epochs: 3

epochs: 4

epochs: 5

epochs: 6

epochs: 7

epochs: 8

epochs: 9
Training done!

I'm using Microsoft Visual Studio C++ 6.0.

I replaced the iostream.h by iostream but I got thesse errors:

--------------------Configuration: IUCUNN - Win32 Debug--------------------
Compiling...
StdAfx.cpp
Compiling...
IUCUNN.cpp
D:\2ª parte\IUCUNN_09_mar\IUCUNN.cpp(149) : error C2065: 'cout' : undeclared identifier
D:\2ª parte\IUCUNN_09_mar\IUCUNN.cpp(149) : error C2297: '<<' : illegal, right operand has type 'char [2]'
D:\2ª parte\IUCUNN_09_mar\IUCUNN.cpp(150) : error C2297: '<<' : illegal, right operand has type 'char [8]'
D:\2ª parte\IUCUNN_09_mar\IUCUNN.cpp(152) : error C2297: '<<' : illegal, right operand has type 'char [9]'
D:\2ª parte\IUCUNN_09_mar\IUCUNN.cpp(153) : error C2297: '<<' : illegal, right operand has type 'char [2]'
Layer.cpp
Matrix.cpp
D:\2ª parte\IUCUNN_09_mar\Matrix.cpp(199) : error C2065: 'cout' : undeclared identifier
D:\2ª parte\IUCUNN_09_mar\Matrix.cpp(199) : error C2228: left of '.width' must have class/struct/union type
D:\2ª parte\IUCUNN_09_mar\Matrix.cpp(200) : error C2296: '<<' : illegal, left operand has type 'double'
D:\2ª parte\IUCUNN_09_mar\Matrix.cpp(200) : error C2297: '<<' : illegal, right operand has type 'double'
D:\2ª parte\IUCUNN_09_mar\Matrix.cpp(202) : error C2297: '<<' : illegal, right operand has type 'char [2]'
D:\2ª parte\IUCUNN_09_mar\Matrix.cpp(204) : error C2297: '<<' : illegal, right operand has type 'char [2]'
Generating Code...
Error executing cl.exe.

IUCUNN.exe - 11 error(s), 0 warning(s)


Can you understand why?

regards

>deprecated, I think that's how its spelled
Yes, that's how it's spelled, but iostream.h is not deprecated. Deprecated is a term for an obsolescent feature of the standard that may be removed in a future revision. iostream.h was never a part of the standard, so it cannot be deprecated. It's simply non-standard.

One way to test this is to look at modern compilers. Use of a deprecated feature is discouraged, but it's still required to be supported by an implementation. As an example, neither Visual C++ .NET, nor Visual C++ 2005 accept <iostream.h> in any capacity.

>I replaced the iostream.h by iostream but I got thesse errors
Rule #1: Don't make a change if you don't understand it. The difference between <iostream> and <iostream.h> isn't just two characters in the name. The standards committee completely revamped the IOStreams library; one of the most notable differences is everything from <iostream> is in the std namespace (failure to qualify that is what causes your errors).

Here's a good beginner example that you can use until you understand how namespaces work:

// Old style (non-standard) C++
#include <iostream.h>

int main()
{
  cout<<"Hello, world!\n";

  return 0;
}
// Standard C++
#include <iostream>

using namespace std;

int main()
{
  cout<<"Hello, world!\n";
}

And I *strongly* recommend that you get a newer version of Visual C++. Visual C++ 6.0 sucks ass. Visual C++ 2005 Express is a free download and is much better for standard C++.

One way to test this is to look at modern compilers. Use of a deprecated feature is discouraged, but it's still required to be supported by an implementation. As an example, neither Visual C++ .NET, nor Visual C++ 2005 accept <iostream.h> in any capacity.

So, Visual C++ 2005 accepts what?

in my program I have this:

Training...
Initiating Layer 1... Done.
Initiating Layer 2... Done.
Initiating Layer 3... Done.
Training done!

output: -1.#IND

target: 1
Press any key to continue

I don't understand the #IND...

>So, Visual C++ 2005 accepts what?
Standard C++.

>I don't understand the #IND...
It's an out of range value, often arising from division by zero. I can't tell you what the exact problem is because I refuse to download an attachment and then unzip it just to debug reams of code that you can't be bothered to shrink down for us.

>So, Visual C++ 2005 accepts what?
Standard C++.

I didn't understand. cout is unrecognized without iostream...

>I don't understand the #IND...
It's an out of range value, often arising from division by zero.

I have division but it never has the zero 'cause is like this:

a.SetElement(i,0, (1/(1 + exp( aux.GetElement(i,0)) ) ) );

I can't tell you what the exact problem is because I refuse to download an attachment and then unzip it just to debug reams of code that you can't be bothered to shrink down for us.

I don´t know how to recreate the problem in a minor code... :o

>I didn't understand. cout is unrecognized without iostream...
<iostream.h> has cout in the "global namespace", so it can be seen and used by everyone without any changes. <iostream> has cout in the std namespace, so you need to say std::cout for the compiler to agree that you're using a cout that it recognizes.

>I have division but it never has the zero 'cause is like this
Often arising from division by zero, but an out of range value can be created in a number of ways. Just look for every place that you change the variable whose value is wrong, and you'll find the problem. Especially if you step through your program and watch the values as they change.

>I don´t know how to recreate the problem in a minor code...
Then perhaps you don't understand your code as well as you think you do. Have you tried incremental reduction, where you cut away pieces of code that don't seem relevant to the problem until you have a smaller program that still exhibits the bad output?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.