Scan numbers as string [closed] - c

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);

Related

Comparison of two dna sequences in C [closed]

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.

Few arguments to function [closed]

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'm trying to understand why I'm getting a " too few argument to function" message
result = total_area (diameter/3);
and same message come when its volume.
I tried calling both base and perimeter, as height but got a different message, also tried changing the numbers but same.
Look at the definition of the function total_area, and you'll find it is defined to take more parameters.
You only gave it one parameter (diameter/3, aka. one-third of the diameter).This function probably needs a diameter and a height, and perhaps some other parameters(we don't really know because you aren't showing us the definition of the function!)
When you find out what it needs, you'll probably want to call it like:
result = total_area (diameter/3, height, width); // See the other parameters??!

How to define vectors of complex numbers with random values of size N in C program [closed]

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 am a beginner, how to define vectors of complex numbers with random values of size N in C program. With this code
complex*vector=(complex*)malloc(sizeof(complex)*N)
You have two separate problems, both of which are already answered.
How work with complex numbers: How to work with complex numbers in C?
How to make an array of random numbers: To generate array of random numbers in a given range in "C"

Analyzing Part of a String [closed]

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.

Two to the power of some large number [closed]

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
Can anyone tell me how to find (2^101100111000)%1000000007 in C?
There is a problem in which we have to convert a number into binary(1<=N<=600000) and find
2^(binary representation of N)modulo1000000007.
The values you are talking about will not fit into a standard long on any architecture, so you will have to use an arbitrary precision maths library such as GMP.
Hmm, just read Zong's answer... he's pointing to a more efficient method... haven't finished reading through the article but it looks like the better way to go...

Resources