## juangalvez4

``````#include <iostream>
#include <string>
#include <cmath>
#include <iomanip>
using namespace std;

int main ()
{
char op= ' ';
int cstart, cend, increment, fstart, fend;

cout << "This program converts and calculates the increment between" << endl;
cout <<"celsius and fahrenheit temperatures"<< endl;

cout << endl << endl;

switch (op)
{

case 'F':
case 'f':
cout << "Please enter the starting Fahrenheit temperature" <<endl;
cin >> fstart;

cout << "Please enter the ending fahrenheit temperature" << endl;
cin >> fend;

cout << "Please enter the increment" << endl;
cin >> increment;

cout << (5/9)*(fstart-32) << fend << endl;

break;

case 'C':
case 'c':
cout << "Please enter the starting Celsius temperature" <<endl;
cin >> cstart;

cout << "Please enter the ending Celsius temperature" << endl;
cin >> cend;

cout << "Please enter the increment" << endl;
cin >> increment;

break;

}

system ("pause");
return 0;
}
{
char op;
cout << "1. Press C to convert celsius to fahrenheit " <<endl;
cout << "2. Press F to convert fahrenheit to celsius " <<endl;
cout << "3. Press Q to quit the program " <<endl;
cin >> op;
return op;
}``````

i need getmenu to be a function.

help?

## jonsca 1,059

If your function definition is after main() you need a prototype for your function at the beginning. It belongs between lines 5 and 7.

## juangalvez4

If your function definition is after main() you need a prototype for your function at the beginning. It belongs between lines 5 and 7.

I did this but its still not working. suggestions?

``````#include <iostream>
#include <string>
#include <cmath>
#include <iomanip>
using namespace std;

int main ()
{
char op= ' ';
int cstart, cend, increment, fstart, fend;

cout << "This program converts and calculates the increment between" << endl;
cout <<"celsius and fahrenheit temperatures"<< endl;

cout << endl << endl;

system ("pause");
return 0;
}
{
char op= ' ';
cout << "1. Press C to convert celsius to fahrenheit " <<endl;
cout << "2. Press F to convert fahrenheit to celsius " <<endl;
cout << "3. Press Q to quit the program " <<endl;
cin >> op;
return op;

}``````

## jonsca 1,059

You don't need the char op in the parameter list. It's not necessary, as you're not passing anything in. The "op" that you've declared in your function is "shadowing" the one in the parameter list (the local one would prevent you from using the parameter, since they have the same name).

Nor do you need the "char" while calling the function on line 18. You need a variable to get the return from the function, but you don't need to send anything in.

Take a quick gander through some websites on functions to see examples. That should reinforce it for you.

## juangalvez4

You don't need the char op in the parameter list. It's not necessary, as you're not passing anything in. The "op" that you've declared in your function is "shadowing" the one in the parameter list (the local one would prevent you from using the parameter, since they have the same name).

Nor do you need the "char" while calling the function on line 18. You need a variable to get the return from the function, but you don't need to send anything in.

Take a quick gander through some websites on functions to see examples. That should reinforce it for you.

``````#include <iostream>
#include <string>
#include <cmath>
#include <iomanip>
using namespace std;

int main ()
{
char op= ' ';
int cstart, cend, increment, fstart, fend;

cout << "This program converts and calculates the increment between" << endl;
cout <<"celsius and fahrenheit temperatures"<< endl;

cout << endl << endl;

switch (op)
{

case 'F':
case 'f':
cout << "Please enter the starting Fahrenheit temperature" <<endl;
cin >> fstart;

cout << "Please enter the ending fahrenheit temperature" << endl;
cin >> fend;

cout << "Please enter the increment" << endl;
cin >> increment;

break;

case 'C':
case 'c':
cout << "Please enter the starting Celsius temperature" <<endl;
cin >> cstart;

cout << "Please enter the ending Celsius temperature" << endl;
cin >> cend;

cout << "Please enter the increment" << endl;
cin >> increment;

break;

}

system ("pause");
return 0;
}

{
char op= ' ';
cout << "1. Press C to convert celsius to fahrenheit " <<endl;
cout << "2. Press F to convert fahrenheit to celsius " <<endl;
cout << "3. Press Q to quit the program " <<endl;
cin >> op;
return op;

}``````

ok great,
but now the switch won't work!?

## jonsca 1,059

getmenu() returns a char, what happened to it? (and no, it doesn't belong back as a parameter). You don't actually assign anything to op in your main(), it stays blank.

## VernonDozier 2,218

You keep over-correcting (i.e. making the needed changes, but then also changing code that was correct). Change line 18 back to what you had originally and don't change anything else!

Line 18:

``op = getmenu();``