Ocena wątku:
  • 0 głosów - średnia: 0
  • 1
  • 2
  • 3
  • 4
  • 5
Rozwiązane FLTK | Problem z kompilacją
#3
0
Wątek do zamknięcia. 

Rozwiązałem swój problem w następujący sposób:

mojprogram.cxx

Kod:
#include "mojprogram.h"

Fl_Double_Window *win=(Fl_Double_Window *)0;

Fl_Button *btn1=(Fl_Button *)0;

Fl_Value_Input *input1=(Fl_Value_Input *)0;

Fl_Value_Output *output1=(Fl_Value_Output *)0;

Fl_Double_Window* make_window() {
  { win = new Fl_Double_Window(255, 205, "Silnia");
    { btn1 = new Fl_Button(70, 145, 105, 25, "Oblicz");
      btn1->callback((Fl_Callback*)zmien);
    } // Fl_Button* btn1
    { input1 = new Fl_Value_Input(70, 25, 85, 25, "Warto\305\233\304\207");
    } // Fl_Value_Input* input1
    { output1 = new Fl_Value_Output(70, 75, 85, 25, "Wynik");
    } // Fl_Value_Output* output1
    win->size_range(255, 205, 255, 205);
    win->end();
  } // Fl_Double_Window* win
  return win;
}

void zmien() {
  int wartosc = input1->value();
  output1->value(silnia(wartosc));
}

int silnia( int n ) {
  if (n <= 1)
  {
  return 1;
  }
  return n * silnia(n-1);
}

int main() {
  make_window();
  win->show();
  return(Fl::run());
}

mojprogram.h

Kod:
#ifndef mojprogram_h
#define mojprogram_h
#include <FL/Fl.H>
#include <FL/Fl_Double_Window.H>
extern Fl_Double_Window *win;
#include <FL/Fl_Button.H>
extern Fl_Button *btn1;
#include <FL/Fl_Value_Input.H>
extern Fl_Value_Input *input1;
#include <FL/Fl_Value_Output.H>
extern Fl_Value_Output *output1;
Fl_Double_Window* make_window();
void zmien();
int silnia( int n );
int main();
#endif


Wiadomości w tym wątku
FLTK | Problem z kompilacją - przez RedMagma - 06-10-2021, 15:12
RE: FLTK | Problem z kompilacją - przez dedito - 06-10-2021, 18:20
RE: FLTK | Problem z kompilacją - przez RedMagma - 22-10-2021, 06:24

Skocz do:




Użytkownicy przeglądający ten wątek: 1 gości