I'm a beginner in C++. I'm not studying it so I don't have a teacher and I don't have a book, a guide. The Internet is my only guide.
Well here's my program:
#include <iostream>
#include <math.h>
using namespace std;
int main ()
{
int q;
float x,y;
Baslangic:
cout << "Para Birimi Seciniz.\n";
cout << " 1: Euro, 2: Amerikan Dolari. Bir Numara Giriniz.\n";
cin >> q;
Euro:
if (q = 1)
cout << "Bugunku Euro Kurunu Giriniz: "; cin >> x; "\n";
cout << "TL Miktarini Giriniz: "; cin >> y; "\n";
cout << y; cout << " TL "; cout << y/x; cout << " Euro Eder.\n";
goto Baslangic;
Dolar:
else
cout << "Bugunku Dolar Kurunu Giriniz: "; cin >> x; "\n";
cout << "TL Miktarini Giriniz: "; cin >> y; "\n";
cout << y; cout << " TL "; cout << y/x; cout << " Dolar Eder.\n";
goto Baslangic;
}
My purpose is to calculate currencies. For instance " X Dollars equal to Y Euros"
And I want to do it this way: First you input "1" or "2" so the program knows what to do. If "1" is pressed, I want it to do the things under "Euro" title. Or else do the things under "Dolar" title.
The sentences in quotes are not relevant. My problem is that I'm not sure if I used if-else correctly. I did a syntax check and it said "expected ';' before 'else'." But there IS a semicolon before "else" so what's the problem?
And I want to know if this expression is correct and proper for my purpose: " if (q = 1)"
Thanks in advance and pardon my broken English.