yeh works perfectly i just did add quotient2 in there. but thanks alot friend..
so by now you should see that i am converting decimals to binary. so is there any way that i could output my value in reverse..
for instance denominator 12, divisor 2, i get 0011 but i want the output to be reverse of that.. so like 1100.. :
ok.. wel its like an error checking homework..
where you do error check..
quotient 12 base 2 output reversed 1100. true
quotient 0 base (value) invalid because its not right.true (output invalid)
again having quotient as an integer than writing a value of 1.2 which is a float n is wrong so output "X".
but you are not allow to ask user's input..
i write all my programs using argc().. so my teacher just basically insert my code into his unknown program and it goes through the error check..
get it>??? :D
int a; // i make a array of 100000 max elements
int rev; // same
int zero=0; // its the pointer of the array "a"
while (quotient > 0) // this is yours
remainder = quotient % base;
quotient /= base;
a[zero]=remainder; // so this puts in to the array "a" 0 0 1 1
cout<< remainder << endl;
zero++; // this is for what place the remainder to be example
// 0 (0)
// 0 (1)
// 1 (2)
// 1 (3)
cout<<":::::::::::::::\n"; // separates
int zero2=0; // second pointer to 0
while(zero>0) // so in the first loop for 0011 the zero was adding 1+ every
// time , we will use it to transfer it to the rev (reverse) array
rev[zero2]=a[zero-1]; // reverse array
// the first number will be the last in the a array
// the second number will be the last - 1 in the a array
// and so on
zero2++; // zero2 ++ so adding the address first,second,third . . .
zero--; // zero -- so the last -1 , last -2 and so on
but if u declare this as int u cant type in characters
so u need a condition that doesnt allow float numbers and zero ?
if so just remove the '!cin' and make quotient2 to be quotient
and quotient to be quotient2.
and it shud be good for running :D
sry for my late answer
no worries my friend i fall aslee hehe :P
in my if statement. i want to have a restriction my friend.
like if its 2e2 it should continue to run the program which it is doing so, but if its for insistance .e2 i should output X