Hi, I'm using Microsoft Visual C++ and I keep getting this error referring to this one line in my main file . can someone HELP ME ?

#include <iostream>

using namespace std;
int main()
{
	float tempFahrenheit;
	float tempCelsius;
	float Omrekenen;

	cout << "Geef de temperatuur in Fahrenheit: ";
	cin >> tempFahrenheit;
	tempCelsius =Omrekenen(tempFahrenheit);
	cout << "\n Dit is de temperatuur in Celsius: ";
	cout << tempCelsius << endl;
	return 0;
}
float Omrekenen(float tempFahrenheit)
{
	float tempCelsius;
	tempCelsius = (tempFahrenheit - 32)*5/9;
	return tempCelsius;
}

Recommended Answers

All 5 Replies

Just like variables, functions have to be declared before you use them:

#include <iostream>

using namespace std;

float Omrekenen(float tempFahrenheit);

int main()
{
	float tempFahrenheit;
	float tempCelsius;
	float Omrekenen;

	cout << "Geef de temperatuur in Fahrenheit: ";
	cin >> tempFahrenheit;
	tempCelsius =Omrekenen(tempFahrenheit);
	cout << "\n Dit is de temperatuur in Celsius: ";
	cout << tempCelsius << endl;
	return 0;
}
float Omrekenen(float tempFahrenheit)
{
	float tempCelsius;
	tempCelsius = (tempFahrenheit - 32)*5/9;
	return tempCelsius;
}

im still having problems, with the code after declaring the function, same error massege

im still having problems, with the code after declaring the function, same error massege

I don't know in what language you are writing, but the reason the compiler complained is that you used the word Omrekenen{what does it mean by the way?} as a function name and as a float...

i changed your code to::

#include <iostream>

using namespace std;

float Omrekenen_func(float tempFahrenheit);

int main()
{
	float tempFahrenheit;
	float tempCelsius;
	float Omrekenen;

	cout << "Geef de temperatuur in Fahrenheit: ";
	cin >> tempFahrenheit;
	tempCelsius =Omrekenen_func(tempFahrenheit);
	cout << "\n Dit is de temperatuur in Celsius: ";
	cout << tempCelsius << endl;
	return 0;
}

float Omrekenen_func(float tempFahrenheit)
{
	float tempCelsius;
	tempCelsius = (tempFahrenheit - 32)*5/9;
	return tempCelsius;
}

and everything compiled fine!

PS:: if this solves your problem, plz mark it the thread as solved!

omreken means to convert, im writing in dutch language .
and de code is working now thank you .

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.