473,385 Members | 1,610 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,385 software developers and data experts.

how to find the cost to convert 1 string into another (find bit difference using xor)

nabh4u
62
hi friends,

i have a probelm with finding the bit difference using xor. i have 2 strings and i have to convert the first tring into another. in order to convert i should get the cost by finding the bit difference when comparing 2 characters of the strings. i am trying to use xor but m not getting success....
please suggest me with a sample code as to how to use xor.

thanking you,
Nabh.
Apr 15 '07 #1
2 1630
hi friends,

i have a probelm with finding the bit difference using xor. i have 2 strings and i have to convert the first tring into another. in order to convert i should get the cost by finding the bit difference when comparing 2 characters of the strings. i am trying to use xor but m not getting success....
please suggest me with a sample code as to how to use xor.

thanking you,
Nabh.
Write what you have done and you will surely get a reply
Apr 18 '07 #2
JosAH
11,448 Expert 8TB
hi friends,

i have a probelm with finding the bit difference using xor. i have 2 strings and i have to convert the first tring into another. in order to convert i should get the cost by finding the bit difference when comparing 2 characters of the strings. i am trying to use xor but m not getting success....
please suggest me with a sample code as to how to use xor.

thanking you,
Nabh.
I don't understand how a 'xor' operation can change one string to another one
unless both strings have equal length. If that is so, there's not much 'cost' to
calculate, i.e. you just change the different characters using that 'xor' thing.

If both strings *don't* have an equal length then I don't understand your question.

Care to elaborate?

kind regards,

Jos

ps. or are you 'xoring' the trailing '\0' byte too?
Apr 18 '07 #3

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

Similar topics

3
by: snacktime | last post by:
I need to calculate the lrc of a string using an exclusive or on each byte in the string. How would I do this in python? Chris
3
by: Dan | last post by:
I am a relatively new user on Oracle 9.2.0.1 and I am having trouble performance tuning this production database. I am running a large query that joins two tables, document(3 mil) and entity(9...
2
by: Phil.Latio | last post by:
I'm trying to write a function to achieve the following; Some bright spark thought it would be a good idea to have a report that has the cost price masked with the first 10 letters of the...
24
by: Sathyaish | last post by:
This one question is asked modally in most Microsoft interviews. I started to contemplate various implementations for it. This was what I got. #include <stdio.h> #include <stdlib.h> #include...
14
by: msnews.microsoft.com | last post by:
How can I encrypt and decrypt string?
5
by: simon | last post by:
I have datetime variable: Datetime tsEndTime; Should I use (DateTime): tsEndTime=(DateTime)rdr.GetValue(15) or is better to use: tsEndTime=Convert.ToDateTime(rdr.GetValue(15))
2
by: Mel Weaver | last post by:
Hello, I'm trying to convert these to functions to c# const C1 = 52845; C2 = 22719; function Encrypt(const S: String; Key: Word): String; var I: byte;
65
by: kyle.tk | last post by:
I am trying to write a function to convert an ipv4 address that is held in the string char *ip to its long value equivalent. Here is what I have right now, but I can't seem to get it to work. ...
29
by: Harlin Seritt | last post by:
Hi... I would like to take a string like 'supercalifragilisticexpialidocius' and write it to a file in binary forms -- this way a user cannot read the string in case they were try to open in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...

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.