Click here to Skip to main content
15,908,906 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: C++ program is not building in G++ (Ubuntu) Pin
Richard MacCutchan29-May-13 22:06
mveRichard MacCutchan29-May-13 22:06 
GeneralRe: C++ program is not building in G++ (Ubuntu) Pin
Manoj739029-May-13 23:47
Manoj739029-May-13 23:47 
QuestionBit concatenation in C++ Pin
Manoj739029-May-13 19:16
Manoj739029-May-13 19:16 
AnswerRe: Bit concatenation in C++ Pin
Richard MacCutchan29-May-13 20:57
mveRichard MacCutchan29-May-13 20:57 
GeneralRe: Bit concatenation in C++ Pin
Manoj739029-May-13 21:18
Manoj739029-May-13 21:18 
GeneralRe: Bit concatenation in C++ Pin
CPallini29-May-13 21:31
mveCPallini29-May-13 21:31 
GeneralRe: Bit concatenation in C++ Pin
Manoj739029-May-13 21:49
Manoj739029-May-13 21:49 
GeneralRe: Bit concatenation in C++ Pin
CPallini29-May-13 23:23
mveCPallini29-May-13 23:23 
Manoj7390 wrote:
If i shift these values i will get more than 1
Of course.


Now look at decimal case:
if you 'concatenate' the digits 1,5,7 then you get the number 157 that is no more in the 0-9 range.
An alternative would be using strings, that is, you concatenate the character representations of the digits into a string ('1'', '5', '7' => "157").

You may apply exactly the same argument to binary (that is base 2) digits: if you concatenate 1,0,0 you get the number 101, that is decimal 5, no more in the 0-1 range. The string concatenation method would give you "101".

You may find interesting the std::bitset[^] class.
However it does not prevent you from gaining a proper understanding of numerical bases (see, for instance, Numeral System at Wikipedia[^]) and how numbers are stored in computers.
Veni, vidi, vici.


modified 30-May-13 5:30am.

GeneralRe: Bit concatenation in C++ Pin
Richard MacCutchan29-May-13 21:38
mveRichard MacCutchan29-May-13 21:38 
GeneralRe: Bit concatenation in C++ Pin
Chris Losinger30-May-13 2:06
professionalChris Losinger30-May-13 2:06 
GeneralRe: Bit concatenation in C++ Pin
Richard MacCutchan30-May-13 2:50
mveRichard MacCutchan30-May-13 2:50 
GeneralRe: Bit concatenation in C++ Pin
Chris Losinger30-May-13 3:16
professionalChris Losinger30-May-13 3:16 
GeneralRe: Bit concatenation in C++ Pin
Richard MacCutchan30-May-13 5:22
mveRichard MacCutchan30-May-13 5:22 
GeneralRe: Bit concatenation in C++ Pin
Chris Losinger30-May-13 5:36
professionalChris Losinger30-May-13 5:36 
GeneralRe: Bit concatenation in C++ Pin
Richard MacCutchan30-May-13 6:19
mveRichard MacCutchan30-May-13 6:19 
GeneralRe: Bit concatenation in C++ Pin
ThatsAlok29-May-13 21:42
ThatsAlok29-May-13 21:42 
GeneralRe: Bit concatenation in C++ Pin
Manoj739029-May-13 21:57
Manoj739029-May-13 21:57 
GeneralRe: Bit concatenation in C++ Pin
ThatsAlok29-May-13 22:25
ThatsAlok29-May-13 22:25 
GeneralRe: Bit concatenation in C++ Pin
Manoj739029-May-13 23:39
Manoj739029-May-13 23:39 
GeneralRe: Bit concatenation in C++ Pin
Richard MacCutchan30-May-13 2:53
mveRichard MacCutchan30-May-13 2:53 
GeneralRe: Bit concatenation in C++ Pin
Manoj739029-May-13 23:58
Manoj739029-May-13 23:58 
GeneralRe: Bit concatenation in C++ Pin
Chris Losinger30-May-13 2:10
professionalChris Losinger30-May-13 2:10 
QuestionCOURSE SCHEDULING PROGRAM IN C++ Pin
Er.Rishi Sharma29-May-13 6:12
professionalEr.Rishi Sharma29-May-13 6:12 
AnswerRe: COURSE SCHEDULING PROGRAM IN C++ Pin
Richard MacCutchan29-May-13 6:49
mveRichard MacCutchan29-May-13 6:49 
GeneralRe: COURSE SCHEDULING PROGRAM IN C++ Pin
Er.Rishi Sharma29-May-13 7:44
professionalEr.Rishi Sharma29-May-13 7:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.