Advertisement
Emanuele_Bruno

Esercizio pag.69 Dispense Puntatori

Jan 9th, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.69 KB | None | 0 0
  1. // ConsoleApplication2.cpp : definisce il punto di ingresso dell'applicazione console.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <iostream>
  6. #include <iomanip>
  7. using namespace std;
  8.  
  9. //FUNCTION PROTOTYPE FOR convert
  10.  
  11. double convert(double *);
  12.  
  13. int main()
  14.  
  15. {
  16.     double measurement;
  17.     cout<<"Enter a length in inches to be converted to centimeters: ";
  18.     cin>>measurement;
  19.     convert(&measurement);
  20.     cout<<fixed<<setprecision(4);
  21.     cout<<"\nValue in centimeters: "<<measurement<<endl;
  22.     return 0;
  23. }
  24.  
  25. //FUNCTION convert
  26.  
  27. double convert(double *length)
  28. {
  29.     cout << "length passata alla funzione " << length << endl;
  30.     cout << "*length passata alla funzione " << *length << endl;
  31.     return *length *= 2.54;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement