call function

Hi there, can you use 7.89 as a function call or variable name?
 
  processData(product, 7.89,"normal", markupPercentage,retail);
you can call the function processData with a value of 7.89 or a variable the contains a value of 7.89 yes. Just be sure that the function parameters has a double or float there.

I don't exactly know the data types of product , markuppercentage , or retail but I'll assume they are doubles since it seems to be with money.

So your function definition probably looks something like this

1
2
3
4
5
6
//don't know your return type so I'll put void

void processData( double product , double price , string normal , double markup , double retail )
{
    //stuff
}


Basically you would do it like this


1
2
3
4
5
6
7
8
9
10
11
void test_function( int i )
{
     std::cout << i << std::endl;
}

int main()
{
    for( int i = 0; i < 10; ++i )
        test_function( i );
    test_function( 1000000 );
}


Hi thanks for the reply. this is what i used
void processData(string productP, float wholesaleCostP,
string &codeP, float markupPercentageP,
float & retailPriceP)
everything looks good but you may have a problem passing "normal" via a reference. Either pass as a copy or set normal to a variable then pass that.
Topic archived. No new replies allowed.