编译器显示警告消息而不执行

问题描述

当同一程序在另一台笔记本电脑上运行时,我的Dev C ++出现错误。谁能帮我这个。它是一个循环算法代码。当我执行此代码时,它显示警告并且不执行程序。

#include<iostream>
using namespace std;
class node
{
    public:
    node *head=NULL;
    node *next;
    int a=64;       //Stores the Ascii value
    int et;         //Execution Time of the process
    char name;      //For name of the process
    
    void insert(int val)
    {
        node *newnode=new node();
        newnode->et=val;
        newnode->name=(char) ++a;
        newnode->next=NULL;
        if(head==NULL)
         {
            head=newnode;
            newnode->next=head;
         }
        else
        {
            node *temp=head;
            while(temp->next != head)
            {
                temp=temp->next;
            }
            temp->next=newnode;
            newnode->next=head;
        }
    }
    
    void schedule(int q,int lim)    //Q-> Time Quantum lim->Total number of the process
    {
        int time=0,count;       //time contains total time of each process which executes according to time quantum
        node *temp=head;
        while(lim!=0)
        {
        if(temp->et<=q&&temp->et>0)
        {
            time=time+temp->et;
            temp->et=0;
            lim--;
            count=1;    
        }   
        else if(temp->et>q)
        {
            time=time+q;
            temp->et=temp->et-q;
        }
        if(temp->et==0 && count==1)
        {
            cout<<"\t"<<temp->name<<"\t\t"<<time<<endl;
            count=0;
        }
        temp=temp->next;
        }   
    }
    
};
int main()
{
    int num,p,tq;
    node obj;
    cout<<"Enter The Number Of  Processes :";
    cin>>num;
    cout<<"Enter The Time Quantum :";
    cin>>tq;
    for(int i=1;i<=num;i++)
    {
        cout<<"Enter The Burst Time Of "<<i<<" Process : ";
        cin>>p;
        obj.insert(p);
    }
    cout<<"Process-Name\tCompletion-Time\n";
    obj.schedule(tq,num);
}

我得到的消息:[警告]仅适用于-std = c ++ 11或-std = gnu ++ 11的非静态数据成员初始化器

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)