i'm practicing my use of functions at the moment by writing a program to convert pounds to euros and vise versa but when i try calling the functions that do the converting i get a load of
'expected primary-expression' errors.
what dose that actually mean because i'm not really sure tbh...
these are the lines its flagging up

if (choise == "p")
 {
            choise = "Euros";
            output = p2e(float input, const float erate); //here
            
 }
 else if (choise == "e")
 {
            choise = "Pounds";
            output = p2e(float input, const float erate); //and here
            
 }

and these are the functions

float e2p (float input, const float erate)
{
      
      cout << "How many Pounds would you like converted to Euros? ";
      cin  >> input;
      
      return input * erate;
}
float p2e (float input, float)
{
      cout << "How many Euros would you like converted to Pounds? ";
      cin  >> input;
      
      return input * erate;
}

thanks in advance :)

Don't put data types with your arguments, where you are calling the functions. Just the argument variables.

For that matter, why are you passing parameter input to the functions, if the input action is done in them? As you have them structured, all your functions need is the conversion rate.

thanks the primary expression error was cleared up by removing the data types, but it flags up more errors if i leave out the variable 'input' about not having enough arguments to function. all i have to do to the program is sort my maths out for the conversion and it works :)

Do you use input somewhere else in the top part of your code, like to display what value was converted? If so, then you should leave it as a parameter to your conversion functions. Also looks like you call p2e() in both cases, should probably be calling e2p() when choise == "e" ?

no i only use input within the conversion functions and looking at it its only complained because i declared it as a parameter in the prototypes so after removing it and making input a local variable in e2p and p2e it all works great now, thanks

>Also looks like you call p2e() in both cases, should probably be calling e2p() when choise == "e"?

i only noticed that after i posted the code lol but its fixed now.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.