Creating a temperature table

  • shankman2k9
  • Born
  • Born
  • shankman2k9
  • Posts: 4

Post 3+ Months Ago

I am needing a little help. I have been very confused in my c++ programming class when it comes to our labs and this week is no different. we have to create a code where it asks the user for degree values and it has to be able to convert from farehnheit to celcius and vice versa. this is what I have so far.

Code: [ Select ]
 
#include <iostream>
using namespace std;
 
int getMenuSelection( );
int getstartendandincremet ();
int ctof();
int ftoc();
int displayctoftable ();
int displayftoctable ();
 
int main (void)
 
{
   
    int displayname();
    {
       
 
 
 
    }







cin.ignore(2);




}
  1.  
  2. #include <iostream>
  3. using namespace std;
  4.  
  5. int getMenuSelection( );
  6. int getstartendandincremet ();
  7. int ctof();
  8. int ftoc();
  9. int displayctoftable ();
  10. int displayftoctable ();
  11.  
  12. int main (void)
  13.  
  14. {
  15.    
  16.     int displayname();
  17.     {
  18.        
  19.  
  20.  
  21.  
  22.     }
  23. cin.ignore(2);
  24. }
Moderator Remark: Use [code][/code] to encapsulate code snippets
  • UPSGuy
  • Lurker ಠ_ಠ
  • Web Master
  • User avatar
  • Posts: 2733
  • Loc: Nashville, TN

Post 3+ Months Ago

You don't need the parentheses following the declaration of the integers since you're not setting an initial value to them. And in that regards, you can shorten up that section a bit to:

Code: [ Select ]
int getMenuSelection, getstartendandincremet, ctof, ftoc, displayctoftable, displayftoctable;


As for the other sections, please try to give it a good faith effort before coming to us for help. I know the language can seem overwhelming, but you should give it a try. All you've given us thus far is essentially an empty application. We don't do homework for people here, so if you need help, then work a little harder at it, first. Here's a quick guide on I/O (cin/cout). You should already know the math operators that you'll need. Here's another guide discussing the basic of integer variable usage.

Good luck!
  • shankman2k9
  • Born
  • Born
  • shankman2k9
  • Posts: 4

Post 3+ Months Ago

I have gotten this much thus far, but cant get it to prompt to put in the start end an increment values.
#include <iostream>
#include <iomanip>
using namespace std;
int getMenuSelection(char& Tempconversion );
int getstartendandincremet (int& start, int& end, int& increment);
int ctof();
int ftoc();
int displayctoftable (int& start, int& end, int& increment);
int displayftoctable (int& start, int& end, int& increment);
int selection;

int main()
{
while ("keepgoing")
{
cout << "Temperature Conversions\n\n" << endl;
cout << "C: Convert form celsius to fahrenheit" << endl;
cout << "F: Convert form Farenheit to Celsius" << endl;
cout << "Q: Quit" << endl;
cout << "Enter your selection:" << endl;
cin >> selection;
cout << "enter Start, End, and Increment on one line separated by spaces: " <<endl;
break;
switch (selection)
{
case 'c':
case 'C':
break;
case 'f':
case 'F':
break;
case 'q':
case 'Q':
break;
default:
break;}
}


cin.ignore(2);
return 0;


}

void displayMenu(void)
{
cout << endl << endl << "Temperature Converter" << endl << endl;
cout << "C: Convert from Celsius to Fahrenheit" << endl;
cout << "F: Convert from Fahrenheit to Celcius" << endl;
cout << "Q: Quit" << endl << endl;
}
char getMenuSelection(void)
{
char selection;
cout << "Enter your selection: " ;
cin >> selection;
return selection;
}
void getStartEndAndIncrement(int& start, int& end, int& increment)
{

}


double CtoF(int C)
{

return 0;
}



double FtoC(int F)
{
return 0;
}


void displayCtoFTable(int start, int end, int increment)
{

cout << "print table header";

for (int i = start; i <= end; i+=increment)
{
cout << "print a row";
}

}


void displayFtoCTable(int start, int end, int increment)
{

cout << "print table header";

for (int i = start; i <= end; i+=increment)
{
cout << "print a row";
}

}

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 20 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.