60 745
Assignments Done
97,8%
Successfully Done
In April 2018

Answer to Question #47698 in C++ for laraib

Question #47698
write a program to convert kilogram into grams by passing pointer as argument to the function
Expert's answer
#include <iostream>
using namespace std;
double convert(double* kilograms);
//main method
int main()
{
double kilograms;
//promt user to enter kilograms
cout<<"Enter kilograms: ";
cin>>kilograms;
//show result
cout<<kilograms<<" kilogram(s) = "<<convert(&kilograms)<<" gram(s).\n";
system("pause");
//exit program
return 0;
}
//function convert to convert kilogram to gram  by passing pointer as argument to the function
double convert(double* kilograms){
return *kilograms*1000;
}


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 first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions