Terminated unexpectedly

I ran my code and got an error.
Process terminated with status -1073741676 (0 minutes, 10 seconds)
The console terminated unexpectedly. Here is my source:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <iostream>
#include "neuron.h"

using namespace std;

int main()
{
    neuron alpha, bravo, charlie;
    bool b__l = true;
    while(b__l)
    {
        for(int i = 0; i < 5; i++)
        {
            if(alpha.send() > 250000 && bravo.send() > 250000 && charlie.send() > 250000)
            {
                b__l = false;
                break;
            }
            alpha.rec1(bravo.send(), charlie.send());
            bravo.rec1(alpha.send(), charlie.send());
            charlie.rec1(alpha.send(), bravo.send());
        }

        cout << "Quit?" << endl;
        char answer;
        cin >> answer;
        switch(answer)
        {
        case 'Y':
        case 'y':
            b__l = false;
            break;
        default:
            b__l = true;
            cout << endl << endl;
            break;
        }
    }
    return 0;
}
does anyone know what I am doing wrong?
maybe something wrong with neuron.h?
at which point does the program terminate? (before or after "Quit?" ? You may want to add more input/output to determine more precisely)
Hi hamsterman! Nice to see you again. :)
neuron created
neuron created
neuron created
m_dat = 2
m_dat = 1
m_dat = 7
m_dat = 0
m_dat = 0
*The program terminates here, without input from user*
Process returned -1073741676 (0xC0000094)   execution time : 2.959 s
Press any key to continue.

The previous was main.cpp
here is neuron.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#ifndef NEURON_H
#define NEURON_H

#include <iostream>

using namespace std;

class neuron
{
    public:
        neuron();
        virtual ~neuron();
        void rec1(int, int);
        void rec2(int, int);
        int send(void);
    protected:
    private:
        int m_dat;
};

#endif // NEURON_H 

And in case you need it
neuron.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include "neuron.h"

neuron::neuron()
{
    //ctor
    cout << "neuron created" << endl;
    m_dat = 5;
}

neuron::~neuron()
{
    //dtor
    cout << "neuron destroyed" << endl;
}
void neuron::rec1(int a, int b)
{
    m_dat = ((m_dat + a) / b);
    cout << "m_dat = " << m_dat << endl;
}
void neuron::rec2(int a, int b)
{
    m_dat = ((m_dat + a) / b);
    cout << "m_dat = " << m_dat << endl;
}
int neuron::send(void)
{
    return m_dat;
    cout << "m_dat sent" << endl;
}

I had it running fine before, before I put the if statement in. I was trying to keep from memory overrun. At least I think that's what it's called. You know when you try to write a number to an in(for example) variable and there is not enough space in said variable. *BAM* Something goes and gets overwritten. i think I did that once with another program already. My windows right-click menu stopped working. Still trying to fix that one. Geesh!
Thanks for responding again.
Last edited on
that's a division by 0 error.
Thanks for your help, hamsterman. Somehow I fixed it. It was the way I wrote lines 17 and 22 in neuron.cpp. you were helpful again. :o) I look forward to working with you, next time.
Topic archived. No new replies allowed.