Fairly new to programming, currently doing a project using FLTK and I want to have an Fl_Int_Input, and use that to create an if statement which depends on what the person types in, something along the lines of:
if(input->value()=='1'){do this;}
if(input->value()=='2'){do this;}
else{do this;}
However when I use 'value', which looking online seems to be the way to use char values in an if statement, an error occurs: ISO C++ forbids comparison between pointer and integer
I think it is because the value is a const char* rather than char. The code runs when I use
if(input->value()=="1"){do this;}
But even if I input 1 nothing occurs
How should I go about using this input to create an if statement?
Like I said I'm pretty new to all of this so I don't know what other relevant information you might need to help, I will try to provide whatever information you might need, these are my includes:
#include <iostream>
#include <sstream>
#include <string>
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Box.H>
#include <FL/Fl_Button.H>
#include <FL/Fl_Check_Button.H>
#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Output.H>
#include <FL/Fl_Input.H>
#include <FL/Fl_Int_Input.H>
#include <FL/Fl_Timer.H>
Typing the code on here, one thing I notice is that the '1' turns a red colour, which doesn't occur on my code, maybe that is relevant?