English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I have been told that this following will tell me what loop to use in my function within my program.......... does anyone have a clue - because I don't.

void PrintGenerations( int count, double AA, double AB, double BB );

I need help!

2007-03-20 13:58:45 · 5 answers · asked by Anonymous in Computers & Internet Programming & Design

This is what I have to do:

Write a program that calculates and displays proportions of different genotypes.
Suppose that initially the three genotypes AA, AB and BB appear in the proportions: x=1/4, y=1/2 and z=1/4, respectively. Suppose that individuals of type AA cannot reproduce. Then the probability that one parent will donate gene A to an offspring is: p = 0.5*(y/(y+z))
because y/(y+z) is the probability that the parent is of type AB and 1/2 is the probability that such a parent will donate gene A. The new proportions x, y and z of AA, AB and BB, respectively, in succeeding generation are given by:
x = p2, y = 2p (1-p) and z = (1-p)2.

Write a program to calculate and display the generation number and the proportions of AA, AB and BB genotypes for a given number of generations. in a table :
---------------------------------------
Generation AA AB BB
---------------------------------------
1 0.2500 0.5000 0.2500
2 0.11

2007-03-20 14:15:19 · update #1

5 answers

It's some times also called "function declaration"; that is to show the structure of the function hiding the implementation of this function it how it works.
A function returns something or nothing and takes something or again nothing; so when you declare a function you show its prototype as:
int get_id (void);
So clearly know that this function returns an integer value and receives no parameters while another function such as:
void set_id (int);
shows that this function returns nothing but receives a parameter of type int (we don't need to write int i or int j or int num ...etc. just "int" is enough since we want only to know the datatype of the parameter rather than the name, though the name is optional in prototypes); we don't know what happens inside until we see the function implementation.
Function prototypes begin before the main function and end with a semicolon as:
//prototype or declaration
int get_square (int);

int main (void)
{
.
.
int num = get_square(4); //we use it here and will return 16
.
.
}

//implementation
int get_square (int i)
{
return i * i;
}

2007-03-20 14:08:58 · answer #1 · answered by Coosa 2 · 0 0

The C++ functionality Prototypes are there to make the compiler chuffed . How's that? initially the compiler desires in simple terms the prototype of the functionality :its call, parameters, and return sort . The compiler reads the source code from authentic to down ; now anticipate u have this code . here, we supply the Prototypes to function foo() , call it in significant() THEN after significant() we define the entire physique for foo () void foo( int x ) ; //prototype void significant() { //Code //................. //call foo( ) foo() ; //Code //.............. }//end significant() //Now define: the foo() functionality void foo ( int x ) { cout<< x ; } What the compiler does is: 1It sees the prototype for foo()It 'is familiar with' it is going to come across functionality spoke of as foo() that takes an int as a parameter and returns void 2.It is going right down to significant() and encounters a functionality spoke of as foo() , yet he does not ***** as he's familiar with its signature 3.After significant() is accomplished, the compiler reveals the comprehensive code for foo () so as to sum up, the compiler desires a minimum of the prototype till now a functionality may be spoke of as ; latter on u can define the comprehensive code fro the functionality Tip : in simple terms sort the entire functionality till now calling it from yet another .

2016-12-19 10:11:57 · answer #2 · answered by ? 4 · 0 0

Sounds like count is how many iterations you use in your loop. As for the other genotype stuff, that's your problem, I'm no biologist.

2007-03-20 14:30:25 · answer #3 · answered by Anonymous · 0 0

We need more information. This function returns a void, so it should not be "telling you" anything. If you have implementation or documentation, we can help you more...

2007-03-20 14:03:35 · answer #4 · answered by sheket 1 · 0 0

You can get cheap freelancers to code your homework
at
http://expert.myitcareer.org/

2007-03-21 01:08:37 · answer #5 · answered by Anonymous · 0 0

fedest.com, questions and answers