A diagnosis by a Doctor of IBS is usually meaning that after many tests for many conditions which have ruled them out, the cause for the problems being experienced are 'unknown',
Like many other terms which are used far too often and lightly (migraine being one - for anyone who ever had a bad headache), IBS is just thrown around anytime anyone has a stomach upset.
If bloating, problems with bowels, etc are being experienced more than once or twice then proper medical investigations need to be carried out. Cutting out certain foods, changing diet is not the first-call answer.
I was in my thirties, and healthy when I first experienced bowel problems - which proved to be due to Ulcerative Colitus (an auto-immune) disease. Despite the rather harsh drug treatments back then, I eventually had to have a permament iliestomy -which gave me a new lease of life and - in fact - my life. Without it I would have long since died.
Keep a note of when you have any such stomach/bowel problem and take yourself and that information to your GP. You may need referral on to a hospital. Do not self-medicate in any way. IF the eventual diagnosis is IBS - with everything else having been ruled out, then a nutritionist can help you work out solutions.