|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
i have a question about c programming.can you help for the solution.thank you . i just use C not C++
Question: Write a C program for a binary notation simulator for positive integer numbers. Your program will ask and get positive integer numbers from user. Program will stop asking new numbers if 0 is input. It will display the binary representation of the input number and the minimum number of digits required to represent that number as given in the sample run. Sample Run: (Italic and bold letters indicate the user input) Enter a positive integer: -5 Enter a positive integer: -3 Enter a positive integer: 5 It is 101. At least 3 digits required. Enter a positive integer: -2 Enter a positive integer: 7 It is 111. At least 3 digits required. Enter a positive integer: 0 Stop... Bye.. |
|
#2
|
|||||
|
|||||
|
Re: C Programming Homework Help Needed
Quote:
Try asking specific questions about algorithms or representation of data. You will be more likely to get useful answers. |
|
#3
|
|||||
|
|||||
|
Re: C Programming Homework Help Needed
Quote:
Perhaps you could walk us through your strategy to design this project, and we could help you out. Here are some questions to think about: How are you going to get the binary value of an integer? How are you going to handle bad input (i.e. negative numbers, and the 0 to escape)? How are you going to handle having a minimum of three output digits? Jacob |
|
#4
|
|||
|
|||
|
Re: C Programming Homework Help Needed
#include <stdio.h>
void main() { int num; printf("Enter a positive integer: "); scanf("%d",&num); while(num!=0) { if(num>0) .... immediate help is needed please ! |
|
#5
|
||||
|
||||
|
Re: C Programming Homework Help Needed
An easy way to go from decimal to binary.
Psuedo Code Quote:
See what you can figure out and feel free to ask for help |
|
#6
|
|||
|
|||
|
Re: C Programming Homework Help Needed
yes you are right.but i'm in the beginning of the programming because i newly started writing some easy programs.i'm only a highschool student and we are not learning c programming lessons now.i write the topic as this was a homework to call your attention..and i have a question waiting for an answer.you are all system engineers or computer software engineers and i think you can give 2 or 3 minutes to my question.i would be very grateful if you can help me on writing the program by steps..
|
|
#7
|
|||||
|
|||||
|
Re: C Programming Homework Help Needed
Quote:
Quote:
Quote:
JamesBrown and garyk have given good advice. Again, if you have specific questions about how to do something, you'll find us ready to answer them. |
|
#8
|
||||
|
||||
|
Re: C Programming Homework Help Needed
I think you're missing the point of those that posted above. Yes, there are people on these boards that could write your program for you in less time than it would take to state the problem, but how is that going to help you as a student? When it comes to learning how to program, I guarantee you that the best way to learn is to struggle through the homework and ask appropriate questions to aid your learning.
The main problem that I see with your approach is that you're looking at the problem as a whole and trying to solve it as a whole. If you were given a large algebra problem like 2x + (x - 4) / x = 3y - x + 2 and were told to solve for y when x was 4, how would you do it? Probably in steps right? You should treat your assignment the same way. So what steps/things do you have to do to complete your assignment? 1. Get an input from the user 2. Determine if the number can be processed 3. If the number can be processed, process it 3a Convert the number to binary 3b Print out the result 4. If the number is 0, print then exit your program The best advice that I can give when you're given an overwhelming problem is to write a little bit, test, fix what's broken, retest, and repeat until the whole problem is done. Try writing a program that first does step 1. Then add on step 2 (you can use prints to let you know whether the number will be processed or not). Then add step 4 (skipping 3 for now). Then add steps 3 and 3b. Notice that I left the hard stuff (binary conversion) until the end. Once your program has the framework to do everything but the binary conversion, add that in. It really isn't as hard as you think it is. Think through the problem piece by piece and I'm sure that you'll be able to work through it. If you run into problems, ask specific questions other than "this is my problem, please give me the answer" and I'm sure that you will be more likely to get the appropriate help. |
|
#9
|
|||
|
|||
|
Re: C Programming Homework Help Needed
i don't need to know your advertisements or whatever you are working in just ask a question and reading some blank messages..
so thank you dave for your kind message.i can write the program but one step is required. you said 3a Convert the number to binary in your message.and i don't know how to find the binary of the number on a program.i can do the others bur the main problem is this part because i don't know it.i want to say it again this is not a homework or assignment because in highschool there is no lesson about programming.i will see c programming on the college next year and i started learning it 3 months ago.i'm new at this and i'm saying that i need help but some of you writing me messages with no knowledge in them.. one step is needed dave waiting your message..thank you.. |
|
#10
|
||||
|
||||
|
Re: C Programming Homework Help Needed
Berkanbaba,
Often the best way to answer a question is to first ask a few in return. Before anyone can help you, I think we need to know: Do you know what binary numbers are? Here's a quick warning: Your profile says you're from Turkey, which in itself is not a problem at all. Understand that in North America we often have different perspectives on what "learning" is. I say this having had family and friends educated overseas, where "learning" centres around memorizing and repetition. Not so much emphasis is put on understanding. You will not find anyone here who will write your program for you. You will find dozens willing to teach you and direct you to source where you will 100% learn and understand how to write your own program. That's approximately infinitely more valuable in my opinion. |
|
#11
|
|||
|
|||
|
Re: C Programming Homework Help Needed
my genius friend slimbo jones
yes i know the binary numbers but don't know how to write on C. Do you know how to write binary numbers in a C program ? i don't know where are you from but think that toronto is not your real town.i don't need your education knowledge or your learning perspective.and i think in your hometown you don't know anythink about helping..but as an engineer you should know this ethic i think. thank you for your genious decisions and opinions but you answered my question with another question and that is your answer i think lol |
|
#12
|
||||
|
||||
|
Re: C Programming Homework Help Needed
My genius friend Berkanbaba,
Toronto is indeed my hometown, and I have been consistently recognized as one of the best engineers in my profession, one of the best business people in my industry, one of the best mentors in FIRST, and one of the best teachers in both computer science and mathematics in my area. I challenge my students, colleagues, and peers at every opportunity, and will now challenge you in the same way. I actually don't believe you know binary numbers. Prove me wrong. Take the number 188, and show us all, step by step, how you would convert it into binary representation. Whether you realize it or not, if you can successfully do this, you'll end up getting the help you so desperately need with your assignment. But only after you do this can the community here help you code each of your steps into C. ...urgently waiting on your reply berkanbaba... Last edited by Mr. Lim : 15-04-2008 at 16:51. |
|
#13
|
||||
|
||||
|
Re: C Programming Homework Help Needed
Quote:
Honestly from what you have said the only thing that would seem to satisfy what you are looking for would be for us to write the program for you which quite frankly i am not going to do. All we ask is that you ask more specific questions. |
|
#14
|
||||
|
||||
|
Re: C Programming Homework Help Needed
Quote:
A quick websearch found a the same kind of tutorial most of us would have written: http://www.swarthmore.edu/NatSci/ech...th/NumSys.html Stop reading (at least for these purposes) at "Hexadecimal, Octal, Bits, Bytes and Words.", and skip mention of negative numbers and fractions. The article gives a good introduction, and even has a couple of self-test questions. I encourage you to not go to Wikipedia, their article is a good reference but a poor tutorial. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| C Programming Homework Help Needed | Pat McCarthy | Programming | 53 | 27-09-2008 22:15 |
| programming help needed | krunal | Programming | 3 | 29-01-2007 00:18 |
| HELP-URGENT PROGRAMMING HELP NEEDED | Rohith Surampudi | Lego Mindstorm Discussion | 1 | 24-03-2006 23:05 |
| URgent Programming Help needed | rcubes85 | Programming | 4 | 15-02-2005 23:21 |