x3fang_c 2023-04-18 19:59 采纳率: 8.7%
浏览 8

关于devcpp的编译问题,如何解决?

我在用devcpp创建一个栈类时出现了一下错误
1.点全部重新编译时:

img


2.点编译运行时:

img


测试.cpp:

#include<bits/stdc++.h>
#include <ctime>
#include <vector>
#include <winsock2.h>
#include<windows.h>
#include<time.h>
#include <fstream>
#include <direct.h>
#include <io.h>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <tchar.h>
#include <string>
#include <string.h>
//#include"2aê?.cpp"
#include <stdlib.h>
#include <Nb30.h>
#include <time.h>
#include <nb30.h>
#include<tchar.h>
#include <windows.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <Iphlpapi.h>
#include <stdio.h>
#include<conio.h> 
#include<typeinfo>
#pragma comment(lib, "netapi32.lib")
#pragma comment(lib, "Netapi32.lib")
#define _CRT_SECURE_NO_DEPRECATE
#include "xstack.h"
using namespace std;
using std::cout; using std::cin;
using std::endl; using std::string;
int main()
{
    string n="123456";
    XStack<string> a("Ss");
    a.push(n);
}

xstack.h:

#pragma once
#include<bits/stdc++.h>
#include <ctime>
#include <vector>
#include <winsock2.h>
#include<windows.h>
#include<time.h>
#include <fstream>
#include <direct.h>
#include <io.h>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <tchar.h>
#include <string>
#include <string.h>
//#include"2aê?.cpp"
#include <stdlib.h>
#include <Nb30.h>
#include <time.h>
#include <nb30.h>
#include<tchar.h>
#include <windows.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <Iphlpapi.h>
#include <stdio.h>
#include<conio.h> 
#pragma comment(lib, "netapi32.lib")
#pragma comment(lib, "Netapi32.lib")
#define _CRT_SECURE_NO_DEPRECATE
using namespace std;
#ifndef XSTACK_H
#define XSTACK_H
typedef unsigned long long int ulli;//y
template <typename T>
class XStack
{
    private:
        string mainzs[100000000];//Ss
        ulli mainzi[100000000];//y
        char mainzc[100000000];//c
        long double mainzd[100000000];//e
        char *type;
        ulli n=1;
    public:
        int pop()
        {
            if(n==1)
            {
                return -1;
            }
            else
            {
                this->n--;
            }
        }
        int pop(T& n)
        {
            char *ch=const_cast<char *>(typeid(n).name());
            if(this->type=="")
            {
                this->type=ch;
            }
            if(n==1)
            {
                return -1;
            }
            else
            {
                this->n--;
                if(this->type=="Ss")
                {
                    
                }
            }
        }
        int push(T n)
        {
            char *ch=const_cast<char *>(typeid(n).name());
            if(this->type=="")
            {
                this->type=ch;
            }
            if(type==ch)
            {
                this->n++;
                if(this->type=="Ss")
                {
                    this->mainzs[this->n]=(string)n;
                }
                else if(this->type=="y")
                {
                    this->mainzi[this->n]=n;
                }
                else if(this->type=="c")
                {
                    this->mainzc[this->n]=n;
                }
                else if(this->type=="e")
                {
                    this->mainzd[this->n]=n;
                }
                return 1;
            }
            else
            {
                return -1;
            }
        }
        bool isfull()
        {
            ulli temp=100000000-1;
            if(n==temp)
            {
                return true;
            }
            return false;
        }
        bool isempty()
        {
            if(n==1)
            {
                return true;
            }
            return false;
        }
        T top()
        {
            switch(type)
            {
                case "Ss" :
                    return mainzs[n];
                case "y" :
                    return mainzi[n];
                case "c" :
                    return mainzc[n];
                case "e" :
                    return mainzd[n];
            }
        }
        int size() {return n;}
        XStack()
        {
            
        }
        XStack(string type)
        {
            if(type!="c"||type!="Ss"||type!="y"||type!="e")
            {
                throw "第一个参数不是指定的参数值 The first parameter is not the specified parameter value"; 
            }
            else
            {
                this->type=const_cast<char *>(type.c_str());
            }
        }
        XStack(string type,T values[],int len)
        {
            if(type!="c"||type!="Ss"||type!="y"||type!="e")
            {
                throw "第一个参数不是指定的参数值 The first parameter is not the specified parameter value"; 
            }
            else
            {
                this->type=type.c_str();
                for(int i=1;i<=len;i++)
                {
                    this->push(values[i]);
                }
            }
        }
        ~XStack()
        {
            
        }
};
#endif


  • 写回答

1条回答 默认 最新

  • CSDN-Ada助手 CSDN-AI 官方账号 2023-04-18 22:03
    关注
    评论

报告相同问题?

问题事件

  • 创建了问题 4月18日

悬赏问题

  • ¥15 气象网格数据与卫星轨道数据如何匹配
  • ¥100 java ee ssm项目 悬赏,感兴趣直接联系我
  • ¥15 微软账户问题不小心注销了好像
  • ¥15 x264库中预测模式字IPM、运动向量差MVD、量化后的DCT系数的位置
  • ¥15 curl 命令调用正常,程序调用报 java.net.ConnectException: connection refused
  • ¥20 关于web前端如何播放二次加密m3u8视频的问题
  • ¥15 使用百度地图api 位置函数报错?
  • ¥15 metamask如何添加TRON自定义网络
  • ¥66 关于川崎机器人调速问题
  • ¥15 winFrom界面无法打开