A C program

J

Joe Pfeiffer

Nikhil Joshi said:
write a program to calculate decimal number from binary number?

We can better help if you'll show us what you've already come up with in
your attempts to write it.
 
K

Keith Thompson

Nikhil Joshi said:
write a program to calculate decimal number from binary number?

We're happy to answer questions about the C language here. Show us
a program, and we can probably help you figure out what's wrong
with it. We won't do your homework for you.

But if you really want us to, please give us your instructor's e-mail
address, so we can submit our solutions directly. If we do the work,
we should get the credit, don't you think?
 
T

tom st denis

write a program to calculate decimal number from binary number?

I'mma gonna go beyond what the other people wrote and just say this.

Drop out of whatever program you are in now. If this sort of program
stumps you you have no business studying computer science nor software
development. This is the equivalent of a math major asking us to help
them solve the matrix

[ 2 1 ]
[ 1 1 ]

It's the sort of thing that if you have to ask you really shouldn't be
in the business.

So please, do yourself and anyone you'd potentially end up working
with a favour and either STUDY FUCKING HARDER or DROP THE **** OUT.

Sincerely,
Tom
 
B

Ben Bacarisse

tom st denis said:
I'mma gonna go beyond what the other people wrote and just say this.

Drop out of whatever program you are in now. If this sort of program
stumps you you have no business studying computer science nor software
development. This is the equivalent of a math major asking us to help
them solve the matrix

I may have missed some of this thread, but how do you know the OP is a
CS major? I was quite good at academic CS, but there was a time when I
did not know how to do this.

<snip>
 
T

tom st denis

I may have missed some of this thread, but how do you know the OP is a
CS major?  I was quite good at academic CS, but there was a time when I
did not know how to do this.

This is clearly a homework question of some sort given the lack of
details other than a fairly obvious problem statement that came from a
lab somewhere.

Tom
 
T

tom st denis

tom st denis said:
This is the equivalent of a math major asking us to help
them solve the matrix
[ 2 1 ]
[ 1 1 ]

What's the answer?

R1-R2 and then R2-R1.

So suppose you had the linear system

[2 1][3]
[1 1][2]

Then you'd have

[1 0][1]
[1 1][2]

And

[1 0][1]
[0 1][1]

So x = 1 and y = 1 in this linear system.

MAGIC!
 
J

James Kuyper

tom st denis said:
This is the equivalent of a math major asking us to help
them solve the matrix
[ 2 1 ]
[ 1 1 ]

What's the answer?

R1-R2 and then R2-R1.

You haven't defined what R1 and R2 refer to, nor what those expressions
mean.
So suppose you had the linear system

[2 1][3]
[1 1][2]

Then you'd have

[1 0][1]
[1 1][2]

And

[1 0][1]
[0 1][1]

So x = 1 and y = 1 in this linear system.

Nor have you defined what x and y refer to.

Your original statement of the problem lacked sufficient detail to make
"solve" an applicable verb. There was sufficient information to use
"invert", instead. If you had added some variables, and asked to solve
for the values of those variables, for example:

"Solve
| 2 1 | |x| = |a|
| 1 1 | |y| |b|

For x and y in terms of a and b"

that would also have been a meaningful question, with the answer x=a-b,
y=2b-a.
 
J

Joe Pfeiffer

tom st denis said:
I'mma gonna go beyond what the other people wrote and just say this.

Drop out of whatever program you are in now. If this sort of program
stumps you you have no business studying computer science nor software
development.

This strikes me as too harsh. This is the sort of thing that will
challenge a freshman (and maybe even a sophomore) the first time they
see it; he does need to be told to do his own homework (and has been);
he only needs to change majors if he doesn't get better.
 
T

tom st denis

This is the equivalent of a math major asking us to help
them solve the matrix
[ 2 1 ]
[ 1 1 ]
What's the answer?
R1-R2 and then R2-R1.

You haven't defined what R1 and R2 refer to, nor what those expressions
mean.

Row 1 and Row 2 ... are you really this dense?
Nor have you defined what x and y refer to.

[2x 1y][3]
[1x 1y][2]

Whatever, you're missing the point. Usually if I say "produce a
solution for this matrix" it means the program [or steps] required to
reduce it to REF. Then when you plug in variables in your column
matrix you need only run the program and voila your solution.

For instance, this is used in Karatsuba and Toom-Cook multiplication.
You end up with a constant matrix but variable column matrix to attach
to it. So the way you solve the system NEVER changes and you can
optimize it thusly.

Tom
 
B

Ben Bacarisse

tom st denis said:
This is clearly a homework question of some sort given the lack of
details other than a fairly obvious problem statement that came from a
lab somewhere.

Yes it is. I don't see how that relates to my message.
 
T

tom st denis

This strikes me as too harsh.  This is the sort of thing that will
challenge a freshman (and maybe even a sophomore) the first time they
see it; he does need to be told to do his own homework (and has been);
he only needs to change majors if he doesn't get better.

I think it boils down to a complete and utter lack of intuition and
drive for knowledge. Likely the person is looking for the easiest
cheap ride through to a diploma so they can then waste peoples time as
a completely worthless software developer.

I could have solved this problem when I was 8 years old. So in
effect, this guy has less intuition about software and computer
science than a C average 8 year old from a small town in Ontario
Canada. That's not saying much for their worth as a student let alone
an eventual professional.
 
T

tom st denis

Yes it is.  I don't see how that relates to my message.

Even if the problem were challenging [which I maintain it is not] the
very lack of effort on their part should be a sufficient strike
against their character.

Tom
 
B

Ben Bacarisse

tom st denis said:
I think it boils down to a complete and utter lack of intuition and
drive for knowledge. Likely the person is looking for the easiest
cheap ride through to a diploma so they can then waste peoples time as
a completely worthless software developer.

I could have solved this problem when I was 8 years old. So in
effect, this guy has less intuition about software and computer
science than a C average 8 year old from a small town in Ontario
Canada. That's not saying much for their worth as a student let alone
an eventual professional.

Using yourself as an example is wrong unless you consider yourself just
about the least talented programmer who ever benefited from studying
programing. I suspect you had an average or above average talent for
programming, which means that there are thousands and thousands of less
talented programmers who, every year, study programming a benefited form
it.
 
T

tom st denis

Using yourself as an example is wrong unless you consider yourself just
about the least talented programmer who ever benefited from studying
programing.  I suspect you had an average or above average talent for
programming, which means that there are thousands and thousands of less
talented programmers who, every year, study programming a benefited form
it.

This guy isn't creating a complicated data compression scheme or
writing a schedule for a pre-emptive OS. It's converting binary to
decimal. It's about as basic as it gets. If this sort of problem
challenges him/her so much that they can't even post their [failed]
attempt at solving it ... they really need to think hard about the
industry they're in.

Worse, if the guy didn't even bother trying and is just looking for a
free ride they should do everyone a favour and step down. Leave room
in the programme for people who actually want to try.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,040
Latest member
papereejit

Latest Threads

Top