arox14

inch2cm_pointer

May 6th, 2019
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstring>
  3. #include <stdio.h>
  4. using namespace std;
  5. float intocm(float &in)
  6. {
  7.     in*=2.54;
  8.     return in;
  9. }
  10. int main()
  11. {
  12.     float *val=new float;
  13.     cout<< "Inches to Centimetre Converter"<<endl;
  14.     cout<<"Enter the lenght(in inch):"<<endl;
  15.     cin >> *val;
  16.     cout <<"Converted length(in cm):" << intocm(*val);
  17. }
  18. /*
  19. OUTPUT:
  20. Inches to Centimetre Converter
  21. Enter the lenght(in inch):
  22. 20
  23. Converted length(in cm):50.8
  24. */
Add Comment
Please, Sign In to add comment