a wrong about EMS
-
when I run the code,it says a wrong about EMS,please help #include using namespace std; void two(int k) { int x,i=1,n; int p1[100],p2[100]; while(i) { i=k/2; x=k%2; k=i; p1[n]=x; n++; } cout<0;n--,a++) { p2[a]=p1[n-1]; //cout<>a; two(a); }
First of all you don't initialize the variable 'n' in your code. so p1[n] is an invalid location. When you try and store a value at that place it would be throwing an error or possibly a crash. Can you just check if this is the root cause?
Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_
-
First of all you don't initialize the variable 'n' in your code. so p1[n] is an invalid location. When you try and store a value at that place it would be throwing an error or possibly a crash. Can you just check if this is the root cause?
Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_