<h2>Yes the swap method exchange parameter values if passed by reference or the value gets changed inside the function.</h2>
Explanation:
Since the program is not given, I will try to guide you about the mode of parameters.
The meaning of swap is interchanging the values. It can be done by using temporary variable or without using it (if the values are integers).
While passing the parameters, there are two ways, call by value/pass by value and call by reference/ pass by reference.
If call by value, then the value gets swapped only inside the function and will not reflected in the calling portion. Call by reference is other way round.
#include
Program: using namespace std;
string createPurchaseOrder0;
int main(
{
cout<return 0;
}
string createPurchaseOrder(
{
int qty;
double costPerltem;
string description,info="":
cout<<"Enter Quantity:
cin>>qty;
cout<<"Enter cost per item: "
cin>>costPerltem;
cout<<"Enter Description: "
cin>>description;
if(qty<0 I| costPerltem<0
Idescription.compare(''"')==0)
cout<<'InThe entered data is invalid!":
info="":
else
"
cout<<"'InThe entered data is valid!":
info=info+"'(nQuantity: "+to_string (qty) +" In";
info=info+"Cost per item:
"†to_string (costPerltem)+"In";
info=info+"Description: "description+" In";
return info;
Output:
Answer:
Step by step explanation along with code and output is provided below
Explanation:
#include<iostream>
using namespace std;
// print_seconds function that takes three input arguments hours, mints, and seconds. There are 60*60=3600 seconds in one hour and 60 seconds in a minute. Total seconds will be addition of these three
void print_seconds(int hours, int mints, int seconds)
{
int total_seconds= hours*3600 + mints*60 + seconds;
cout<<"Total seconds are: "<<total_seconds<<endl;
}
// test code
// user inputs hours, minutes and seconds and can also leave any of them by entering 0 that will not effect the program. Then function print_seconds is called to calculate and print the total seconds.
int main()
{
int h,m,s;
cout<<"enter hours if any or enter 0"<<endl;
cin>>h;
cout<<"enter mints if any or enter 0"<<endl;
cin>>m;
cout<<"enter seconds if any or enter 0"<<endl;
cin>>s;
print_seconds(h,m,s);
return 0;
}
Output:
enter hours if any or enter 0
2
enter mints if any or enter 0
25
enter seconds if any or enter 0
10
Total seconds are: 8710
That's a fiber connection direct to the internet service provider,
and a whopping monthly charge.