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
#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);
Comments
Leave a comment