Answer to Question #217273 in C++ for Hemambar

Question #217273
create a structures sterling that has three members pounds, siblings and pence all of type int. Write three functions .the first should get these three values separately from the user and return the value as a structure. The second should take two arguments of type string and return the added value as same type .the third function should take the structure as argument and convert it to decimal pounds (double type) and the double value .write a main problem that accept two sterlings inputs from the user as a separate values construct them as structure and add them and display the result in double type
1
Expert's answer
2021-07-16T01:04:36-0400


#include <iostream>


using namespace std;


struct sterling{
    int pounds, siblings, pence;
    
};
sterling getValues(sterling s){
    cout<<"\nEnter pounds: ";
    cin>>s.pounds;
    cout<<"\nEnter siblings: ";
    cin>>s.siblings;
    cout<<"\nEnter pence: ";
    cin>>s.pence;
    
    return s;
}
string addStrings(string s1,string s2){
    return (s1+s2);
}
double convertPound(sterling c){
    double pounds2=c.pounds;
    return pounds2;
}
int main()
{
    sterling p;
    getValues(p);
    addStrings("car","book");
    convertPound(p);
    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS