小编Mat*_*w C的帖子

缺少C++显式类型(假设为"int")

嗨,我的c ++代码有错误.我有2个.cpp文件和1个.h文件,我试图从头文件中访问5个字符串和1个int,但是我得到一个错误,上面写着"显式类型丢失('int'假设).

我还有一些其他错误:缺少类型说明符,Shops :: Items重定义; 不同的基本类型,重载函数只有返回类型不同,声明不兼容.

这是我的文件:

UserChoice.h

#include <iostream>
#include <string>

using namespace std;

#ifndef USERCHOICE_H
#define USERCHOICE_H

class Shops
{
public:

    double Items(string, string, string, string, string, int);

    int main()
    {
        std::cout << newItem1;
    }

private:
    string newItem1;
    string newItem2;
    string newItem3;
    string newItem4;
    string newItem5;
    int newItems;

};
#endif
Run Code Online (Sandbox Code Playgroud)

Items.cpp

#include "UserChoice.h"

Shops::Items(string Item1, string Item2, string Item3, string Item4, string Item5, int     Items)
{
    newItem1 = Item1;
    newItem2 = Item2;
    newItem3 = Item3;
    newItem4 = Item4; …
Run Code Online (Sandbox Code Playgroud)

c++ int compiler-errors header class

0
推荐指数
2
解决办法
2万
查看次数

标签 统计

c++ ×1

class ×1

compiler-errors ×1

header ×1

int ×1