and code below. thank you Please provide the function or module header in in c++ code for each of the following. Include comments that describe the parameters and return values (if a value is returned). Do not define the function, just give the header or prototype and comments. Be sure to indicate if the parameters need to be passed by reference. 1. Swaps two reals. 2. Calculates and returns the sales tax of 8.25 given the price and the amount of the tax rate (both as reals). 3. Returns the concatenation of two strings. 4. Performs a search of a string for a character and returns true if the character is found and false otherwise. Swaps two reals void swap(float&,float&);//used to swap two integers.parameters are passed by reference Calculates and returns the sales tax of 8.25 given the price and the amount of the tax rate float calculate(float,float);//returns the sales tax of 8.25 given the price and the amount of the tax rate Returns the concatenation of two strings. string combine(string ,string );//returns the concatenated string of given strings Performs a search of a string for a character and returns true if the character is found else false bool find(string ,char );//checks for the given character in the string and returns true if string have the given character otherwise false. Step 1 Function Prototype-: void swap(float&,float&);//used to swap two real number with float parameters are passed by reference , return type is void float calculate(float,float);//returns the sales tax of 8.25 given the price and the amount of the tax rate which is of float type string combine(string ,string );//returns the concatenated string of given strings , return type is string bool find(string ,char );//checks for the given character in the string and returns true if string have the given character otherwise false, return type is bool Step 2 Function Definition not needed as per your question but I have attached for yours's understandability-: void swap(float &a, float &b)//used to swap two real number with float parameters are passed by reference , return type is void { float temp=a; a=b; b=temp; } float calculate(float price, float taxrate)//returns the sales tax of 8.25 given the price and the amount of the tax rate which is of float type { float salestax; salestax= (taxrate/100) *price; } string combine(string a,string b)//returns the concatenated string of given strings , return type is string { return a+b; } bool find(string s ,char a)//checks for the given character in the string and returns true if string have the given character otherwise false. { bool search=false; int i=0; while(s[i]!='\0') { if(s[i]=='a') { search=true; break; } i++; } }
For the question below how can I concatenate using and object like append()? for the pseudocode section 3 and code below. thank you
Please provide the function or module header in in c++ code for each of the following. Include comments that describe the parameters and return values (if a value is returned). Do not define the function, just give the header or prototype and comments. Be sure to indicate if the parameters need to be passed by reference.
1. Swaps two reals.
2. Calculates and returns the sales tax of 8.25 given the price and the amount of the tax rate (both as reals).
3. Returns the concatenation of two strings.
4. Performs a search of a string for a character and returns true if the character is found and false otherwise.
void swap(float&,float&);//used to swap two integers.parameters are passed by reference
float calculate(float,float);//returns the sales tax of 8.25 given the price and the amount of the tax rate
string combine(string ,string );//returns the concatenated string of given strings
bool find(string ,char );//checks for the given character in the string and returns true if string have the given character otherwise false.
Function Prototype-:
void swap(float&,float&);//used to swap two real number with float parameters are passed by reference , return type is void
float calculate(float,float);//returns the sales tax of 8.25 given the price and the amount of the tax rate which is of float type
string combine(string ,string );//returns the concatenated string of given strings , return type is string
bool find(string ,char );//checks for the given character in the string and returns true if string have the given character otherwise false, return type is bool
Function Definition not needed as per your question but I have attached for yours's understandability-:
void swap(float &a, float &b)//used to swap two real number with float parameters are passed by reference , return type is void
{
float temp=a;
a=b;
b=temp;
}
float calculate(float price, float taxrate)//returns the sales tax of 8.25 given the price and the amount of the tax rate which is of float type
{
float salestax;
salestax= (taxrate/100) *price;
}
string combine(string a,string b)//returns the concatenated string of given strings , return type is string
{
return a+b;
}
bool find(string s ,char a)//checks for the given character in the string and returns true if string have the given character otherwise false.
{
bool search=false;
int i=0;
while(s[i]!='\0')
{
if(s[i]=='a')
{
search=true;
break;
}
i++;
}
}
Step by step
Solved in 3 steps with 1 images