Problem z kompilacją...
Ostatnio zmodyfikowano 2010-01-22 10:20
xkrolikx06x Temat założony przez niniejszego użytkownika |
Problem z kompilacją... » 2010-01-20 23:07:26 Witam ponownie, tym razem program nie chce mi skompilować programu i nie wiem dlaczego. Oto kod: #include <iostream> #include <conio.h> int main() { using namespace std; menu: cout << "_____________" << endl; cout << "1-dodawanie |" << endl; cout << "-------------|" << endl; cout << "2-odejmowanie|" << endl; cout << "-------------|" << endl; cout << "3-mnozenie---|" << endl; cout << "-------------|" << endl; cout << "4-dzielenie--|" << endl; cout << "**************" << endl; int menu; cin >> menu; switch( menu ) { case 1: system( "cls" ); cout << "Podaj PIERWSZA LICZBE:" << endl; double a; cin >> a; system( "cls" ); cout << "Podaj DRUGA LICZBE:" << endl; double b; cin >> b; system( "cls" ); cout << "PIERWSZA LICZBA to - " << a << endl; cout << "DRUGA LICZBA to - " << b << endl; cout << "" << endl; cout << "Twoj wynik to: " << a + b << endl; cout << "" << endl; cout << "UWAGA!!!" << endl; cout << "Program zaokragla liczby do 2 miejsca po przecinku!!!" << endl; cout << "" << endl; cout << "____________________" << endl; cout << "" << endl; cout << "Co chcesz teraz zrobic?" << endl; string wybor; cout << "Wybierz i wpisz odpowiednią opcje:" << endl; cout << "menu/wyjscie" << endl; cout << "Twoj wybor to: "; cin >> wybor; if( wybor == "menu" ) { goto menu; } else if( wybor == "wyjscie" ) { cout << "Dzieki za wybranie tego programu - Kacper ;)" << endl; cout << "" << endl; cout << "Nacisnij dowolny klawisz by wyjsc..." << endl; } break; case 2: system( "cls" ); cout << "Podaj PIERWSZA LICZBE:" << endl; double a1; cin >> a1; system( "cls" ); cout << "Podaj DRUGA LICZBE:" << endl; double b1; cin >> b1; system( "cls" ); cout << "PIERWSZA LICZBA to - " << a1 << endl; cout << "DRUGA LICZBA to - " << b1 << endl; cout << "" << endl; cout << "Twoj wynik to: " << a1 - b1 << endl; cout << "" << endl; cout << "UWAGA!!!" << endl; cout << "Program zaokragla liczby do 2 miejsca po przecinku!!!" << endl; cout << "" << endl; cout << "____________________" << endl; cout << "" << endl; cout << "Co chcesz teraz zrobic?" << endl; string wybor1; cout << "Wybierz i wpisz odpowiednią opcje:" << endl; cout << "menu/wyjscie" << endl; cout << "Twoj wybor to: "; cin >> wybor1; if( wybor1 == "menu" ) { goto menu; } else if( wybor1 == "wyjscie" ) { cout << "Dzieki za wybranie tego programu - Kacper ;)" << endl; cout << "" << endl; cout << "Nacisnij dowolny klawisz by wyjsc..." << endl; } break; case 3: system( "cls" ); cout << "Podaj PIERWSZA LICZBE:" << endl; double a2; cin >> a2; system( "cls" ); cout << "Podaj DRUGA LICZBE:" << endl; double b2; cin >> b2; system( "cls" ); cout << "PIERWSZA LICZBA to - " << a2 << endl; cout << "DRUGA LICZBA to - " << b2 << endl; cout << "" << endl; cout << "Twoj wynik to: " << a2 * b2 << endl; cout << "" << endl; cout << "UWAGA!!!" << endl; cout << "Program zaokragla liczby do 2 miejsca po przecinku!!!" << endl; cout << "" << endl; cout << "____________________" << endl; cout << "" << endl; cout << "Co chcesz teraz zrobic?" << endl; string wybor2; cout << "Wybierz i wpisz odpowiednią opcje:" << endl; cout << "menu/wyjscie" << endl; cout << "Twoj wybor to: "; cin >> wybor2; if( wybor2 == "menu" ) { goto menu; } else if( wybor2 == "wyjscie" ) { cout << "Dzieki za wybranie tego programu - Kacper ;)" << endl; cout << "" << endl; cout << "Nacisnij dowolny klawisz by wyjsc..." << endl; } break; case 4: system( "cls" ); cout << "Podaj PIERWSZA LICZBE:" << endl; double a3; cin >> a3; system( "cls" ); cout << "Podaj DRUGA LICZBE:" << endl; double b3; cin >> b3; cout << "" << endl; system( "cls" ); cout << "Dzielna to: " << a3 << " - jest to PIERWSZA LICZBA" << endl; cout << "Dzielnik to: " << b3 << " - jest to DRUGA LICZBA" << endl; cout << "" << endl; cout << "Twoj wynik to: " << a3 / b3 << endl; cout << "" << endl; cout << "UWAGA!!!" << endl; cout << "Program zaokragla liczby do 2 miejsca po przecinku!!!" << endl; cout << "" << endl; cout << "____________________" << endl; cout << "" << endl; cout << "Co chcesz teraz zrobic?" << endl; string wybor3; cout << "Wybierz i wpisz odpowiednią opcje:" << endl; cout << "menu/wyjscie" << endl; cout << "Twoj wybor to: "; cin >> wybor3; if( wybor3 == "menu" ) { goto menu; } else if( wybor3 == "wyjscie" ) { cout << "Dzieki za wybranie tego programu - Kacper ;)" << endl; cout << "" << endl; cout << "Nacisnij dowolny klawisz by wyjsc..." << endl; } break; } getch(); return( 0 ); }
Tym bardziej że po zostawieniu tylko jednego case'a wszystko działa ładnie. Za wszelką pomoc bardzo dziękuję;] |
|
malan |
» 2010-01-21 00:21:38 switch( menu ) { case 1: { } break; case 2: { } break; case 3: { } break; } |
|
xkrolikx06x Temat założony przez niniejszego użytkownika |
» 2010-01-21 09:31:36 Dziękuje bardzo za pomoc ;) |
|
malan |
» 2010-01-22 10:20:02 ... ten też :). |
|
« 1 » |