小编Sop*_*ald的帖子

没有构造函数的类中的C++非静态const成员

我一直收到这个错误:

警告:没有构造函数的类中的非静态const成员'const char sict :: Weather :: _ date [7]'[-Wuninitialized]

我不明白.

main.cpp中

#include <iostream>
#include <iomanip>
#include "Weather.h"
using namespace std;
namespace sict{

int main(){
    int n; 
    Weather* weather;

    cout << "Weather Data\n";
    cout << "=====================" << endl;
    cout << "Days of Weather: ";
    cin >> n;
    cin.ignore();
    weather = new Weather(n);

    for (int i = 0; i < n; i++){
        char date_description[7];
        double high = 0.0, low = 0.0;

        cout << "Enter date: ";
        cin >> date_description;
        cout << …
Run Code Online (Sandbox Code Playgroud)

c++

2
推荐指数
1
解决办法
2314
查看次数

标签 统计

c++ ×1