473,655 Members | 3,056 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

solve problem

1 New Member
HI guies can u help me to solve this problem.
Expand|Select|Wrap|Line Numbers
  1. Write a program that prints a table of the binary equivalents of the decimal numbers in the range 1 through 256.
Mar 11 '08 #1
5 1818
sicarie
4,677 Recognized Expert Moderator Specialist
The experts on this site are more than happy to help you with your problems but they cannot do your assignment/program for you. Attempt the assignment/program yourself first and post questions regarding any difficulties you have or about a particular function of the code that you don't know how to achieve.

Please read the Posting Guidelines and particularly the Coursework Posting Guidelines.

Then when you are ready post a new question in this thread.

MODERATOR
Mar 11 '08 #2
Sick0Fant
121 New Member
I can say with total confidence that it is unsolvable. There is an infinity of numbers between any two decimal numbers, so it's unlikely you'll ever print them all.

Now, if you meant integers ...
Mar 11 '08 #3
whodgson
542 Contributor
You need to write a function which will convert a positive integer into its binary equivalent and then a main() test driver to test the function with various input. Can you manually convert from base 10 to base 2 ? (dec to bin)
e.g. Using base 10 176 comprises 6 1`s + 7 10`s + 1 100 = 6+70 +100=176
So the columns are ........etc. 100000 10000 1000 100 10 1
Using base 2 the colums are multples of 2 instead of 10
............... ............... .......etc.1024 512 256 128 64 32 16 8 4 2 1
so a binary number like 1 0 1 1 0 1 0 1 1 0 0
would equal 1024 + 256+128 + 32 + 8+ 4 = 1452

and 176 to base 10 = 0 1 0 1 1 0 0 0 0 in binary
From the above you may be able to develop the required algorithn on which to base your code.
Sorry i couldn`t keep the columns lined up!
Mar 13 '08 #4
sicarie
4,677 Recognized Expert Moderator Specialist
Sorry i couldn`t keep the columns lined up!
It is difficult, but I find putting things in code tags helps. Just something to consider if you really need to show formatted data in the future.
Mar 13 '08 #5
whodgson
542 Contributor
Thanks......... .. will do.
Mar 14 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
12787
by: BVM | last post by:
Hi, All: I have this error. It seems execution time is too long. Actually the execution time is about 30 seconds(I tested in Query analyzer). How do I solve this problem? System.Web.Services.Protocols.SoapException: System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not...
3
1846
by: Alex | last post by:
Hi, I have a problem involving some design issue. I have two unrelated (that is, they do not derive from the same base) classes: ClassA ClassB Both have a quite similar interface, so they can be use interchangeably, that is: ptr = new ClassA;
7
2002
by: Shapper | last post by:
Hello, I have an ASP:ImageButton where I want to call a function and pass a string: OnClick="Change_Photo("John")" I am having problems with "". I tried
6
2486
by: Federico | last post by:
Hi, this is what I can do: - Create new solutions using VS.Net ASP.Net - Save the solutions, build the solution, view in browser with the solution still open. But, once I close the solution, I can not open it again in VS.Net2003 because it hangs my machine (the whole machine stops responding and there's no alternative but to reboot it!). I can't either browse the created solution because it also hangs the whole machine.
0
1329
by: Jitesh | last post by:
I am facing a problem in webservice, I want to know what will be the exact procedure to solve the problem............. What I want to do............ I have a table named order in SQL Server. There are some fields including OrderID, DomainNameURL, SessionID. I want to create a webservice which takes a parameter(SessionID) and return the details from order table. Here OrderId works as a Unique key. but In some cases when SessionID is not...
27
2296
by: John Salerno | last post by:
Ok, here's a problem I've sort of assigned to myself for fun, but it's turning out to be quite a pain to wrap my mind around. It's from a puzzle game. It will help if you look at this image: http://www.johnjsal.devisland.net/switches.jpg Here's the situation: Each of the four rows in the diagram is considered a single 'panel'. Each panel has eight 'switches', which are composed of two columns each, and these columns have a total of 20...
8
4801
by: vj | last post by:
Hi all, I want to solve the two equations u*tan(u)=w and u^2 + w^2=V^2, where V is a known constant, and u and w are the two unknowns to be determined. Please can someone suggest me how to write a code and solve these equations in C or C++? I am not an expert, but have elementary working knowledge of C.
1
2663
by: arun | last post by:
Query is too complex -------------------------------------------------------------------------------- Hi, I was trying to solve this problem since last two days but couldn't find any solution. I wanted to execute a query which is retrieving the records from table1 by checking the condition for a long long string . I'm using where clause and checking the condition as-
17
4091
by: Michael Reichenbach | last post by:
Here is the example code. int main(int argc, char *argv) { string Result; WIN32_FIND_DATA daten; HANDLE h = FindFirstFile(TEXT("c://test"), &daten); system("PAUSE"); return EXIT_SUCCESS; }
2
2372
by: itsvineeth209 | last post by:
My task is to create login control without using login control in tools. I shouldnt use sqldatasource or any other. I should use only data sets, data adapters and data readers etc. U had created table login with fields username(varchar(50)), password(varchar(50)), firstname(varchar(50)), lastname(varchar(50)). U had to display username , first name, last name in default.aspx page after login. One more condition is that, if user fails login...
0
8380
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8816
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8710
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8497
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6162
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4150
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2721
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1928
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1598
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.