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?