Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I'm new to C and I have an assignment where I have to build a dictionary (Linked List in a way). Basically the user inputs several words,year and their definition this:
Example:
love_#_2004_#_LOVING
trade_#_2001_#_INVEST
etc...
And basically I need a function to scan the definition (Ex: INVEST)
and gives me the word trade.
If the definition is related to more than only one word to give me back all the words it relates to.
What sort of a function do I need to scan these strings?
If the word you search is always the last one and the formatting is always the same, then use strtok with _ and copy the last entry, which holds the string you are looking for.
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
So lets say I have received a message that resembles the following
"L2N5*8R10!11T0A1K3Y14#4W7O6O9C12R13"
and I am expected to sort out the characters in accordance to the numbers succeeding them and change the characters that are not letters into a space. I have no problem doing the sorting out part, I am only having a trouble while trying to write a function that will change those characters into space.
The out put should be something like this
TALK NOW OR CRY
but I am getting
TALK#NOW*OR!CRY
Can anyone help me figure out what my function should look like so that I can be able to change the characters into space??
Unless you show your code, we'll only be able to guess!!
However, as a general suggestion, I would recommended, you should check each entry against isalpha(). In case you got a return value of 0, replace the entry with a .
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I would like to compare two dna sequences in C. How can i compare two strings and gets the difference?
Let's say:
seq_a:
GATCAACGCAAAGGACTAAGCACTGCTGCCAAA
and
seq_b:
GATCAACGCAAAGGACTAAGCACTGCTGCCTGC
result: TGC or GATCAACGCAAAGGACTAAGCACTGCTGCC***
Hard-code the traversal of two strings in a while loop. If they're the same, output either string1[i] or string2[i]. If they're different, write a star.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Improve this question
my input is of form of: number:number for example 16:13
my goal is to take this input and break it to the two numbers.
for example first number is 16, second number is 13.
is there a way to use SCANF to read the numbers directly? or the only was is to use a function to convert the string to numbers after i lose the separator?
i can not change the format of the input.
This should do the trick.
scanf_s("%d:%d", &num1, &num2);
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I want to make a C program to arrange a jumble word into meaningful English word.There is a file "dictionary.txt" which contains lots of jumbled words. So, i have to write a program which read the jumble word from this file and convert it into a meaningful word.
For example:-
dictionary.txt file exits a "epemaxl" word
when we provide this input, the output should come "example".
I have searched alot over internet but didnot get a suitable example according to this.
Please help me.
Thanks in advance.
One strategy can be to calculate the levenshtein distance and select the word that has the closest levenshtein distance to your jumble word.
If you are on Linux (say Debian or Ubuntu, can't tell about the rest of flavors), you could skip the making of real dictionary and just check with /usr/share/dict/ wordlist.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I found this line in Linux Audio drivers soc-core.c inside sound folder:
int regsize = codec->driver->reg_word_size * 2;
Can anybody please explain the meaning of * 2?
Multiply the contents of codec->driver->reg_word_size by 2. I guess this is a translation between size in words to size in bytes.
Multiplies that value by 2. That's all it does
Well, I can just guess, but it looks like this:
codec is a pointer to a structure, which has a pointer to another structure in driver, which has a member variable reg_word_size (which it seems is, like the name says, the size of a register word). This value gets doubled (*2).
This could be, like the other answer says, a conversion between bytes and words. However, it could probably also just mean that this regsize should be twice as big as the reg_word_size.