#include <iostream> #include <cstdlib> #include <unistd.h> #include <ncurses.h> #include <curses.h> using namespace std; float a,b; char w; int main() { while(true) { cout << "Podaj pierwsza liczbe"<< endl; cin >> a; cout << "Podaj druga liczbe"<< endl; cin >> b; cout << "Menu:"<< endl; cout <<"--------------------"<<endl; cout << "1. Dodawanie."<<endl; cout << "2. Odejmowanie."<<endl; cout << "3. Dzielenie."<<endl; cout << "4. Mnozenie."<<endl; cout << "5. Podaj ponownie liczby."<<endl; cout << "6. Wyjscie z programu."<<endl; cout <<"--------------------"<<endl; cout <<endl; w = getch(); switch (w) { case '1' : cout<< a+b; break; case '2' : cout << a-b; break; case '3' : if (b==0) { cout<< "Nie dzielimy przez zero!!!"; } else cout<< a/b; break; case '4' : cout << a*b; break; case '5' : system("exit"); break; case '6' : exit(0); break; default : cout<< "Nie ma takiej opcji!!"; } getchar();getchar(); system("clear"); } return 0;
Nie moge znalesc alteratywy dla conio.h pod linuxa probowalem curses.h <ncurses.h>.
Wywala błędy:
undefined reference to `stdscr'
undefined reference to `wgetcg'
Znalazlem "rozwiazanie"http://stackoverflow.com/questions/1513417/why-is-curses-on-linux-giving-me-following-error po skompilowaniu w terminalu z opcja -lncurses program nie dziala poprawnie .