C++[Error] expected primary-expression before '{' token怎么解决

做个解鸡兔同笼的程序,加了个while,结果就提示[Error] expected primary-expression before '{' token,望大神帮忙解决。图片说明

#include<iostream>
using namespace std;
int main()
{
    int a,b,c,d,e,f,g; 
    cout<<"问笼中两动物各几只请按1 退出请按2"<<endl; 
    cin>>g;
    while
    {
                if(g==1)
        {
            cout<<"[动物一脚数必须比动物二脚数小]"<<endl;
            cout<<"脚的数量?"<<endl;
            cin>>a; 
            cout<<"头的数量?"<<endl;
            cin>>b; 
            cout<<"动物一脚数?"<<endl;
            cin>>e;
            cout<<"动物二脚数?"<<endl;
            cin>>f;
            d=(a-(b*2))/(f-e);
            c=b-d;
            cout<<"动物一的只数="<<c<<" "<< "动物二的只数="<<d<<endl; 
        }
            cout<<"是否继续运行?"; 
            cin>>g;
        if(g=2)
        {
            return 0;
        }
    }
 } 

楼上正解,不过楼上if(g==2)应移到while外,否则永不能执行。
错误原因是while循环必须有条件。可以while(true),while(1)等。
要学会看错误信息,看不懂就去百度翻译。

#include<iostream>
using namespace std;
int main()
{
    int a,b,c,d,e,f,g; 
    cout<<"问笼中两动物各几只请按1 退出请按2"<<endl; 
    cin>>g;
    while (g == 1)
    {
            cout<<"[动物一脚数必须比动物二脚数小]"<<endl;
            cout<<"脚的数量?"<<endl;
            cin>>a; 
            cout<<"头的数量?"<<endl;
            cin>>b; 
            cout<<"动物一脚数?"<<endl;
            cin>>e;
            cout<<"动物二脚数?"<<endl;
            cin>>f;
            d=(a-(b*2))/(f-e);
            c=b-d;
            cout<<"动物一的只数="<<c<<" "<< "动物二的只数="<<d<<endl; 
            cout<<"是否继续运行?"; 
            cin>>g;
        if(g==2)
        {
            return 0;
        }
    }
 }