I tried to write a program that uses if loops to check if a char variable had certain value:

/*
FreeFull
Software
*/
#include <iostream>
using namespace std;
float dark_rays;
float light_rays;
float ball;
float universe;
float matter;
char menu;
char darkmenu;
char lightmenu;

int main()
    {
    cout << "Dark Rays.\n";
    cin >> dark_rays;
    cout << "Light Rays.\n";
    cin >> light_rays;
    cout << (dark_rays - light_rays) + (light_rays - dark_rays) << "\n";
    cout << "This universe belongs to FreeFull.\n";
    ball = dark_rays + light_rays;
    universe = ball;
    matter = dark_rays + light_rays / 2;
    goto menu;
    menu:
     cout << "a=matter b=dark_rays c=light_rays q=quit";
     cin >> menu;
     if(menu == 'a')
         {
         goto matter;
         }
     else if(menu == 'b')
         {
         goto dark;
         }
     else if(menu == 'c')
         {
         goto light;
         }
     else if(menu == 'q')
         {
         goto quit;
         }
     else
         {
         cout << "Invalid.\n";
         goto menu;
         }
    matter:
     cout << matter << "\n";
     goto menu;
    dark:
     cout << dark_rays << "\n";
     cout << "What do you want to do?\na=add, s=subtract, m=menu\n";
     cin >> darkmenu;
     if(darkmenu == 'a')
      {
      dark_rays = dark_rays + 1;
      goto dark;
      }
     else if(darkmenu == 's')
      {
      dark_rays = dark_rays - 1;
      goto dark;
      }
     else if(darkmenu == 'm')
      {
       goto menu;
      }
     else
      {
      cout << "Invalid";
      }
    light:
     cout << light_rays << "\n";
     cout << "What do you want to do?\na=add, s=subtract, m=menu\n";
     cin >> lightmenu;
     if(lightmenu == 'a')
      {
      light_rays = light_rays + 1;
      goto light;
      }
     else if(lightmenu == 's')
      {
      light_rays = light_rays - 1;
      goto light;
      }
     else if(lightmenu == 'm')
      {
       goto menu;
      }
     else
      {
      cout << "Invalid";
      }
     quit:
      return 0;
    }

When I try to compile it I get these errors:

universe.cpp:31: error: ISO C++ forbids comparison between pointer and integer
universe.cpp:35: error: ISO C++ forbids comparison between pointer and integer
universe.cpp:39: error: ISO C++ forbids comparison between pointer and integer
universe.cpp:43: error: ISO C++ forbids comparison between pointer and integer
universe.cpp:59: error: ISO C++ forbids comparison between pointer and integer
universe.cpp:64: error: ISO C++ forbids comparison between pointer and integer
universe.cpp:69: error: ISO C++ forbids comparison between pointer and integer
universe.cpp:81: error: ISO C++ forbids comparison between pointer and integer
universe.cpp:86: error: ISO C++ forbids comparison between pointer and integer
universe.cpp:91: error: ISO C++ forbids comparison between pointer and integer

Can someone say what is wrong and help me?

No such error in my case. Which compiler are you using ? Just a thought, try keeping different variable names for the GOTO labels and your normal variables and see if that makes a difference.

the label menu: (line 28) hides the variable char menu (line 12). you could use the scope
resolution operator (::menu) to make the error go away; but hiding names like this is not a good idea.
technically, a label is a pointer (address).

A strange thing happened, this time it compiled fine. I didn't changed source code but I installed additional compiler packages. I'm using MinGW with minsys.

just to make sure, compile with
g++ -std=c++98 -Wall
and see if you get any warnings or errors.
no errors or warnigs for me too.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.