what kind of error?

#include<iostream>

using namespace std;

int main()
{
int i=10,j=5,m=0,d=0;

m=i%j;


d=i/m;
cout<<d;
return 1;
}

i am new to c++ so please help me. i tried this out on a mingw compiler , the executable file opens and the "has stopped working" error message comes up , what kind of error is this
PS: process returns some other value and not 1
You're dividing by zero.
please answer...Im writing the following code on a mingw compiler:


1 #include<iostream>
2
3 using namespace std;
4
5 int main()
6 {
7 char a;
8 int val;
9
10 cin>>a;
11 cin.ignore();
12 cin>>val;
13 cin.ignore();
14 while ((a!="t") && (val<500)){
.....code.....
15 }
16 return 0;
17 }
the problem is in the 14th line,maybe cause the 'a' is 'char'.how can i fix this???
Last edited on
Please create your own thread for that. It's not polite to hijack someone else's thread with your own problem.
closed account (28poGNh0)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# include<iostream>
using namespace std;

int main()
{
    char a;
    int val;

    cin >> a;
    cin >> val;
    cin.ignore();

    while ((a!='t') && (val<500))
    {
        cout << "You answered your own question " << endl;
    }
    return 0;
}
thank you very very much!
i just wrote (a!="t") instead of (a!='t')
you truly don't know how much you've hepled me!!
closed account (28poGNh0)
You're welcome dont forget to create you own thread
Topic archived. No new replies allowed.