Decimal to Binary

Pages: 12
It's spoonlicker!
closed account (4z0M4iN6)
Framework wrote:
I asked a question in regards to why some examples were incorrect


Framework wrote:
What's wrong with mine?


atrium wrote:
"it prints the digits in reverse order"


Framework wrote:
It depends on the endianness of your system.


Framework had heard something about little endian and big endian. This he thought would be a good explanation, that others didn't think his example would be wrong. He thought, the example could have worked on another machine.

atrium wrote:
Good point. Thank you.


Atrium also had heard about little endian and big endian and so he thought also, the example could have worked on another machine.

cire wrote:
No, it doesn't. =)


Cire sais no, because he knows, what this is.

Framework wrote
Evidence to support that remark?


1
2
3
4
5
6
7
// Framework still thinks, he is right, and he wants to be right.
Framework still thinks, he is right
Also would he like to hear, what endianness is.

// Cire don't answer, because he don't like discussions with Framework,
//which lead to nothing and only waste time.
Cire don't answer // We cannot know, why 

So Framework won the discussion, and is right.
And now he want's also win the discussion with me.

Framework asked:
I asked a question in regards to why some examples were incorrect


And what do I say?

The example of Framework is wrong.
The explanation "endianess" is nonsense.
Framework don't know, what endianess is.
Atrium maybe he knows or he don't know
Cire knows.
And me knows.
And should I explain, what endianess is?
If Framework thinks, endianess would explain, that he is right, so shall Framework explain, why he should be right, and what endianess is.
But this he can't because:

Dadabe wrote
But most programmers seem to know nearly nothing about it.
Last edited on
closed account (4z0M4iN6)
firedraco wrote:
It's spoonlicker!

Now you could see, how well I can spoonlick such posts.
Cire don't answer, because he don't like discussions with Framework,
which lead to nothing and only waste time.


I would appreciate it if you, in your voluminous fuzzy-headed pontification, would refrain from speculation about my motivations -- you have it wrong.
There are some on this forum who spend far too much time looking for hidden meanings behind posts.

What someone knows or does not know cannot necessarily be inferred from a few posts over a short period of time. Computers follow logic; human beings do not. Until that is understood, all that emerges is empty prattle. Many years ago I heard a saying, "Empty cans make the most noise", and it was never more true than here
closed account (zb0S216C)
dadabe wrote:
"Also would he like to hear, what endianness is.... Framework don't know, what endianess is."

I know full well what endianness is. I don't need somebody to explain it.

quote wrote:
"And what do I say?"

You said nothing. I still haven't heard a valid reason as to why my example was bad.

dadabe wrote:
"The explanation "endianess" is nonsense."

Bullshit. When it comes to bits, endianness has everything to do with it.

Out of all honesty, you're chattin' s***t.

Wazzak

Bullshit. When it comes to bits, endianness has everything to do with it.


This is not correct. Endianness concerns byte order in memory. Bitwise operations don't depend on byte order in the manner you suggested, so while endiannness may affect where a particular bit is in memory for an int, it doesn't have anything to do with the bit shift operation in question.

This is, in fact, why bit-shifting is preferred for storing ints in an endianness-independent fashion.
Last edited on
closed account (4z0M4iN6)
Dadabe wrote:

Cire don't answer, because he don't like discussions with Framework,
which lead to nothing and only waste time.


Cire wrote:
I would appreciate it if you, in your voluminous fuzzy-headed pontification, would refrain from speculation about my motivations -- you have it wrong.


Sorry Cire, I should had thought it over better, what I write.

I should have written only the fact in my post:
Cire don't answer


I suggest I should correct this.

But I suggest also, that you should correct your speculations. Fitting would be:

I would appreciate it if you would refrain from speculation about my motivations -- you have it wrong.


My Question: how to correct a post?

Is this done by comment like

//

for the old lines.

And by

EDIT:

for the new lines?

And if you say so: you have it wrong, I will take this for true
Maybe I should have written only the facts and not, how it could look like
This wasn't, what I believe (I doubt all - means, also doubt my doubts), but what it could look like
closed account (4z0M4iN6)
atrium wrote:
There are some on this forum who spend far too much time looking for hidden meanings behind posts.

I can't imagine, who would do this?

I only saw until now:
There are many in this forum, who spend too less time for the true meaning or to think about, whether their assumption, which they make is true or wrong.

It shouldn't be a problem, to assume something, because people don't say someting like 4+5=9, so we sometimes only can assume something, about what could have been ment.

But the probleme is, many assume something, which could be true or not true and believe, it would be true.

And they give evidence about this by writing angry replies about something, what they have assumed and in this replies they make assumptions about someones minds.

What has someones minds to do with what they have thought? They first should think about their own thoughts, before they doubt other people minds.

It's true, in my post, I wrote something, which could be assumed. Somebody could assume this. But do I believe, these assumptions would be true? No! It would have taken much time, to sort out, what really is fact, what the exact meaning of every word would have been. The easiest way is, to show, what could be assumed and ask, whether these assumptions would be ok or not.

I posted and you responded. And you will see no assumptions about someones braines in my post like "Empty can" or "voluminous fuzzy-headed pontification". Because I know about what is true and what isn't true. And how can I know about this? I doubt all. But not like others normally understand this. Most others understand only half of it. And they forget "doubt all" means also "doubt your doubts". And this means I also hold everything as possible. And so I know the truth. And what is the truth: maybe it's true or not true.
Or you could say also: I know, that I don't know

And before I had read your post, I already had thought about, what you had said, and what the real meaning is, what you had said:

Good point // Good argument, but don't mean the other is right
Thank you // Good etiquette, but don't mean thankfulness

Between Good point and Thank you, missing lines: nothing was said about yes or no. Why, we don't know. Maybe he knows or he don't know.

Now you have my thoughts and you can make up your mind about my braines

And "empty can"?
You are on the right track.
I think it's called "open mind"


And I think other ways like many. For example:

Some one says something.
Same other says something different.
The first is wrong.
What about the other and true?


And maybe, because I said, I don't believe nothing, and doubt all, it seems, that I can't know nothing.
I can show you, that I know truths:

Somebody, who says "spoonlicker", isn't a philosopher.
If somebody thinks, I would be wrong, he is also not a philosopher.
And I will not explain this, for somebody, who can't understand this.

And now about, what I had said before about examples, assumptions, and why I think, a post shouldn't be a place, which you should dump full with examples without clear thoughts, then you should have a look, about what other users say:

http://cplusplus.com/forum/beginner/70842/

And I can also show you earnest progressed states of users, which you have dumped full with your listings, and who cannot think any more:

http://cplusplus.com/forum/beginner/70898/

And you shouldn't make assumptions, like this user would be dumb.

You should better think about your examples, maybe you can grasp, how they make dumb.

But I doubt, you could grasp this.

If I shall show you, you can ask me, to show this.
I can show you this, when I have time .
Last edited on
closed account (4z0M4iN6)
Framework wrote:
What's wrong with mine? Matri X's? Come on, Mr. C++ Master, enlighten us all with your thorough expertise.

Hi Framework, I didn't think about the difference between not working examples and wrong working examples.

And now I must say, your example is the best in this post.


A not working example:

You buy a car and want to drive it. But it don't go. You look inside and see: no motor inside. It's clear, that this cannot function. But there is nothing to learn. This we should have known already before.

But very interesting is a wrong working example.

You know, you want to drive forward, but the car goes backward. Everybody wants to know, why this? And looks and explores and understands, what's wrong und so also understands what's right. This is easier and more interesting than thinking about the ideas of a good example.

What I discovered:

You can learn much of a good example.
You can learn more of a wrong example.
You can learn most of bugs (but this isn't a case for beginners)

But what's not good

Somebody walked a long way, maybe 4 km and had reached his destination. Then he looks and sees something interesting 100 m farther. We know, what the normal way would be. But he also could do this. Go back to the start and then walk 4 km and 100 m. Yes I have to admit, this also works. But if a beginner would think, the normal way of programming would be, to know about such tricks, then he soon will wonder what would be the trick for something like Value = Value - 200
Last edited on
closed account (zb0S216C)
@dadabe: You really need to stop bangin' on, and post relevant information.

A few point to note on bit-shifting:

1) Shifting to the right with a negative (signed) operand is implementation-defined.
2) Shifting to the left (past the signed range) with a negative (signed) operand is implementation-defined.
3) Shifting to the left & right with an unsigned operand is well-defined.

Edit: @cire: Noted :) Thanks for that.

Wazzak
Last edited on
closed account (4z0M4iN6)
Framework wrote:
@dadabe: You really need to stop bangin' on, and post relevant information.

I will not bang anymore, because I said all, what had to be said. And my concern wasn't about bits and bytes, but how to respect the wishes of the users, who need some help. If they ask for some idea and not for listings, you should first ask them, whether they also would like to see your listing.

What others think about such listings, and how I can explain this, you can read in this post:

http://cplusplus.com/forum/beginner/70942/

And if you want to know about shifting and bit and bytes, I recommend an assembler course.

PS: besides, you don't seem to know, what is relevant information.

And because it could be so with an signed operand, we will avoid this by:

1
2
3
int SignedOperand;

unsigned int Operand = * (unsigned int *) &SignedOperand;
Last edited on
closed account (1vRz3TCk)
Giving code is a valid way of 'giving ideas'. You could argue that it is a very efficient way, the user does not have to read your english description and then try to implement it is C++.

Now, we all know that for some reason you two (Framework and dadabe) don't see eye to eye but it would be nice if you could keep the bickering to a minimum or just go the the Lounge and thrash it out there.
closed account (4z0M4iN6)
I already said, what was to say.

Thanks for listening.
Last edited on
closed account (1vRz3TCk)
If it matters at all, another way (unless I missed it in an earlier post):
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <iostream>

void Dec_to_Bin(int n)
{
    if ( n < 0)
    {
        std::cout << "-";
        n = -n;
    }
    if (n == 0)
        return;
    Dec_to_Bin (n/2);
    std::cout << n%2;
}

int main()
{
    Dec_to_Bin(2123);
    std::cout << std::endl;
    Dec_to_Bin(-2123);
    return 0;
}
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
check this
#include<conio.h>
#include<iostream.h>
int n,i=0;
void  main()
{
clrscr();
int x;
cout<<"Enter the decimal number ";
cin>>x;
while(x>0)
{
int array[100],div,rem;
rem=x%2;
array[i]=rem;
div=x/2;
x=div;
i++;
}
cout<<endl<<"i ="<<i<<endl;
n=i;

for(i=(n-1);i>=0;i--)
{  int array[100];
cout<<array[i];

}
getch();}
Topic archived. No new replies allowed.
Pages: 12