c++ - Finding the difference between two temperature -


i have function supposed find difference between 2 temp's. first off print out celsius , approx fahrenheit , find , print difference between them. problem happens when run program output difference 58 everything.

where should print out this:

c----af----diff 1----32----31 2----34----32 

etc.

my code:

void caldiff(int& cel, int& appfar, int diff){ while(cel!= 101){     diff = appfar - cel;     cout << diff << endl;     cel++;     appfar++; } } 

  1. you need function convert celsius fahrenheit.
  2. you don't want change cel , appfar, remove reference &.

int cel2far(int cel) {      // convert cel far , return approx. far }  void caldiff(int cel, int appfar, int diff) {     while(cel!= 101){         diff = appfar - cel;         cout << diff << endl;         cel++;         appfar = cel2far(cel);     } } 

Comments

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -