473,320 Members | 1,881 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How to declare a bit string?

hello everyone,

can anyone tell me how i can declare a bit string in C++
Sep 29 '13 #1
9 1884
weaknessforcats
9,208 Expert Mod 8TB
What do you consider to be a bitstring?

I can't tell if you mean a <bitset> or a vector<unsigned int> or just a simple array.
Sep 29 '13 #2
bitstring secret_msg_bit;

thats the code
the secret message is a hash digest
Sep 29 '13 #3
weaknessforcats
9,208 Expert Mod 8TB
There's no such thing in C++. The code quoted could be Python.

Do you know the format of this bitstring?
Sep 29 '13 #4
all what i know that this is an pseudo code
Sep 30 '13 #5
Nepomuk
3,112 Expert 2GB
OK, my guess would be that a "bitstring" is not what programmers normally know as Strings but rather a series of bit values. Now, implementing that can be done in many different ways; which would be the best depends on how you will be using them. Is the number of bits unchanging or may some be added during runtime? How do you want to use the bitstream - mainly read from it? Mainly write to it? In the order they are saved or randomly?
Sep 30 '13 #6
as it a secret message it supposed to be a fixed number of bits
Sep 30 '13 #7
Nepomuk
3,112 Expert 2GB
OK, so you know you need bits. What are bits? Which datatype can represent single bits?
Then you need a fixed number of them. Which collection type may hold a fixed number of a given datatype?
When you've figured those two things out, you can use typedef to define what a bitstring is and then you can use the newly introduced datatype bitstring in your code.
Oct 1 '13 #8
so i can use int array this what do u mean?
Oct 1 '13 #9
Nepomuk
3,112 Expert 2GB
That should work, yes.
Oct 2 '13 #10

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

Similar topics

2
by: Bengt Richter | last post by:
Why wouldn't quote-stuffing solve the problem, and let you treat \ as an ordinary character? In a raw string, it's no good for preventing end-of-quoting anyway, unless you want the literal \ in...
10
by: Angus Leeming | last post by:
Hello, Could someone explain to me why the Standard conveners chose to typedef std::string rather than derive it from std::basic_string<char, ...>? The result of course is that it is...
2
by: HumanJHawkins | last post by:
The following query works perfectly (returning all words on a list called "Dolch" that do not contain a form of "doing"): SELECT 'Dolch' AS , dbo.Dolch.vchWord FROM dbo.Dolch LEFT OUTER JOIN...
10
by: Spare Change | last post by:
I am told that I can have a dynamic or static string array. So if I declare string dynamic; How do I add elements to dynamic and resize it ?
4
by: Diffident | last post by:
Hello All, I have a string of around 150 characters. string test = "asjhdkashdkjahsdjkhaskjdhaskjdhasjdhasd........."; //(upto 150 characters) I want to split the above string into multiple...
6
by: Diffident | last post by:
Dear Bruce, Can you please explain me how compiler would be able to optimize "+" for the below code? The reason why I did not want to use string concatenation was that I wanted it to be a...
15
by: angellian | last post by:
Sorry to raise a stupid question but I tried many methods which did work. how can I conserve the initial zero when I try to convert STR(06) into string in SQL statment? It always gives me 6...
10
by: Visual Systems AB \(Martin Arvidsson\) | last post by:
Hi! Got a simple question. I am new to c# but this is not making me any sence. If i declare: string myStringArray = new string; How the heck could i fill it with more than one element? ...
35
by: Smithers | last post by:
I have been told that it is a good idea to *always* declare string variables with a default value of string.Empty - for cases where an initial value is not known... like this: string myString =...
16
by: Anil Gupte/iCinema.com | last post by:
Can someone please explan the difference between Dim temp as String() and Dim temp() as String in terms of syntax and practical usage? I thought I knew, but of late have become confused...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.