Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Computer Forums > Programmers Lounge > Programming Discussions » Reading a book about C#. (newbie question)
Closed Thread
Old 04-04-2009, 09:36 PM   #1 (permalink)
Chad711's Avatar
 
Monster Techie

Join Date: Oct 2008

Location: Irving, TX

Posts: 1,175

Chad711 is on a distinguished road

Default Reading a book about C#. (newbie question)

Let's just say I know nothing about programming. I have read some other books but lets just assuming I don't know anything when answering my questions here!

So I have this book called "Beginning C#" and I am using VS 2008. Some I am reading along and just barely into the book. Most the stuff so far is pretty straight forward. Not much about code yet. Mostly just introducing the UI of VS.

So I am at this part where it's introducing Variables. The first part if Simple Types. Every thing at this point is easy understanding then he says this:

"A variable storing "N" bits will allow us to represent any numbers between 0 and (2n - 1). Any numbers above this value will be too big to fit into this variable.

Note - the "n" that is in the parenthesis is suppose to be to the power of 2 but I don't know how to show that in the forum.

Ok so what is he talking about here? I'm totally lost. Is this some sort of math equation I'm suppose to understand or he just trying to tell me that N is a variable that could be any thing I make it? I got so lost here. He was explaining simple stuff then he throws this in there and made me look like a lost puppy!

Check back here when ever you see me post if you want to help me out! I will use this from now on.
__________________
Q6600 OC 3.0, 4870 1GB,750w, 4GB DDR2, T-Power I45, Extreme Audio X-Fi OS: Windows7-64-Pro, Contact Core Freezer, Acer G24"/LG 22"
Chad711 is offline  
Old 04-05-2009, 08:12 PM   #2 (permalink)
 

Join Date: Jul 2005

Location: England

Posts: 2,158

kmote has a spectacular aura aboutkmote has a spectacular aura about

Default Re: Reading a book about C#. (newbie question)

Really what he is saying is a simple binary concept. Where n is the size of the variable in bits the number of values that variable can hold can be calculated by the sum 2^n. For example, if your variable is 8 bits it can have a value between 0 and 255 (or 256 values).
__________________
MSI P43 Neo|Enermax Pro82+ 425W|E5200|silent 8500GT|250GB Samsung spinpoint F1|Samsung SATA DVD RW|4GB Corsair|Antec SOLO|openSUSE11


There are in order of increasing severity: lies, darn lies, statistics, and computer benchmarks. - diskinfo man page
kmote is online now  
Old 04-05-2009, 11:25 PM   #3 (permalink)
Chad711's Avatar
 
Monster Techie

Join Date: Oct 2008

Location: Irving, TX

Posts: 1,175

Chad711 is on a distinguished road

Default Re: Reading a book about C#. (newbie question)

Ok I still don't understand completely but at least I know where he is going with it. I think my lack of not doing any math for many years might be part of the reason...

I'm just going to go with it and keep reading. This book is so big. Tiny print and 1030 pages!!! If I ever finish this, it will be the biggest book I ever read. hahaha
__________________
Q6600 OC 3.0, 4870 1GB,750w, 4GB DDR2, T-Power I45, Extreme Audio X-Fi OS: Windows7-64-Pro, Contact Core Freezer, Acer G24"/LG 22"
Chad711 is offline  
Old 04-06-2009, 07:59 AM   #4 (permalink)
office politics's Avatar
 
It's all just 1s and 0s

Join Date: Jan 2004

Location: in the lab

Posts: 4,410

office politics will become famous soon enough

Default Re: Reading a book about C#. (newbie question)

What is the binary system?

give this a read, then re-read this thread.

the link should give a better understanding of binary numbers.
office politics is offline  
Old 04-06-2009, 12:15 PM   #5 (permalink)
Chad711's Avatar
 
Monster Techie

Join Date: Oct 2008

Location: Irving, TX

Posts: 1,175

Chad711 is on a distinguished road

Default Re: Reading a book about C#. (newbie question)

That helped out with understanding binary a little more for sure. Thank you for that link
__________________
Q6600 OC 3.0, 4870 1GB,750w, 4GB DDR2, T-Power I45, Extreme Audio X-Fi OS: Windows7-64-Pro, Contact Core Freezer, Acer G24"/LG 22"
Chad711 is offline  
Old 04-06-2009, 07:04 PM   #6 (permalink)
office politics's Avatar
 
It's all just 1s and 0s

Join Date: Jan 2004

Location: in the lab

Posts: 4,410

office politics will become famous soon enough

Default Re: Reading a book about C#. (newbie question)

do you know which numbers you can represent using 5 bits?
office politics is offline  
Old 04-06-2009, 07:12 PM   #7 (permalink)
Chad711's Avatar
 
Monster Techie

Join Date: Oct 2008

Location: Irving, TX

Posts: 1,175

Chad711 is on a distinguished road

Default Re: Reading a book about C#. (newbie question)

would that be:

00000101?
__________________
Q6600 OC 3.0, 4870 1GB,750w, 4GB DDR2, T-Power I45, Extreme Audio X-Fi OS: Windows7-64-Pro, Contact Core Freezer, Acer G24"/LG 22"
Chad711 is offline  
Old 04-06-2009, 07:16 PM   #8 (permalink)
 

Join Date: Jul 2005

Location: England

Posts: 2,158

kmote has a spectacular aura aboutkmote has a spectacular aura about

Default Re: Reading a book about C#. (newbie question)

That would be the representation of 5 but I think the question office_politics was after is "what numbers can be represented by 5 bits" he is looking for a range.
__________________
MSI P43 Neo|Enermax Pro82+ 425W|E5200|silent 8500GT|250GB Samsung spinpoint F1|Samsung SATA DVD RW|4GB Corsair|Antec SOLO|openSUSE11


There are in order of increasing severity: lies, darn lies, statistics, and computer benchmarks. - diskinfo man page
kmote is online now  
Old 04-06-2009, 08:01 PM   #9 (permalink)
Chad711's Avatar
 
Monster Techie

Join Date: Oct 2008

Location: Irving, TX

Posts: 1,175

Chad711 is on a distinguished road

Default Re: Reading a book about C#. (newbie question)

Oh ok. So 0 to 31 then? Correct?

edit: which is 32 bits
__________________
Q6600 OC 3.0, 4870 1GB,750w, 4GB DDR2, T-Power I45, Extreme Audio X-Fi OS: Windows7-64-Pro, Contact Core Freezer, Acer G24"/LG 22"

Last edited by Chad711; 04-06-2009 at 08:04 PM.
Chad711 is offline  
Old 04-06-2009, 08:11 PM   #10 (permalink)
 

Join Date: Jul 2005

Location: England

Posts: 2,158

kmote has a spectacular aura aboutkmote has a spectacular aura about

Default Re: Reading a book about C#. (newbie question)

Quote:
Originally Posted by Chad711 View Post
Oh ok. So 0 to 31 then? Correct?
Correct.

Quote:
Originally Posted by Chad711 View Post
edit: which is 32 bits
What do you mean? It's 32 different values, yes.
__________________
MSI P43 Neo|Enermax Pro82+ 425W|E5200|silent 8500GT|250GB Samsung spinpoint F1|Samsung SATA DVD RW|4GB Corsair|Antec SOLO|openSUSE11


There are in order of increasing severity: lies, darn lies, statistics, and computer benchmarks. - diskinfo man page
kmote is online now  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
32-bit WinXP question, regarding RAM White_Wolf Windows Operating Systems and Software 1 12-21-2008 03:19 PM
Extreme newbie here, grateful to have found you and with a question: DRPS05 Programming Discussions 5 12-19-2008 09:00 PM
Samba Questions - Can I use "test" as an acct? + Home Dir Mapping Question. Jayce Linux, BSD, other *nixes & Open Source Software 0 12-01-2008 05:14 AM
Get this book Oreo Off Topic Discussion 3 07-30-2008 03:27 PM
Quick LCD panel question. Akubane Building, Buying, or Upgrading High Performance PC Systems 2 04-08-2008 02:07 PM