Answer to Question #16346 in C++ for Sunny

Question #16346
Write a program that converts kilogram into grams by using a user defined function. Use the return statement in the program.
1
Expert's answer
2012-10-16T09:44:03-0400
#include<iostream>
using namespace std;

float kg, g;

int kgtog(float kg){
& return kg*1000;
}

void main(){
cout<<"enter a value: ";
cin>>kg;
cout<<kg<<" kg = "<<kgtog(kg)<<" g\n";
system("pause");
}



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
APPROVED BY CLIENTS