Siemka, napisałem program do przeliczania temperatur ale coś w nim jest nie tak bo na koniec konwertowania wywala mi błąd żę nOpcja i nJednostka to niezdefiniowane zmienne, ale je zdefiniowałem z Funkcji(), i potem wywołałem ją w main().
Aha, i nie mówcie żę za mało kodu bo reszte sytuacji z temperaturami podam później na razie chciałem tylko sprawdzić co nie działa.
// Przelicznik temperatur
#include <iostream>
#include <conio.h>
#include <cmath>
#include <string>
using namespace std;
void Funkcja()
{
int nTemp;
cout << "Podaj temperature do przekonwetowania: ";
cin >> nTemp;
int nJednostka;
cout << "W jakiej jendostce jest ta tenperatura?" << endl;
cout << "1.Kelwin" << endl;
cout << "2.Farenheit" << endl;
cout << "3.Celcius" << endl;
cout << "Twoj wybor: ";
cin >> nJednostka;
cout << endl;
int nOpcja;
cout << "Na jaką jednsotke chcesz przekonwertowac temperature:" << endl;
cout << "1.Kelwin" << endl;
cout << "2.Farenheit" << endl;
cout << "3.Celcius" << endl;
cout << "Twoj wybor: ";
cin >> nOpcja;
cout << endl;
}
void main()
{
Funkcja();
if (nJednostka = 1, nOpcja = 1)
{
cout << "To ta sama jednostka!" << endl;
}
getch();
}