samedi 29 mai 2021

getting this error: [Warning] exteded initializer lists only avalable with -std=c++11 or -std=gnu++11 [duplicate]

I did include list but i am getting this error! can someone please help me? i dont understand whats going on. Help is really aprreciated!

#include <iostream>
#include <iomanip>
#include <list>
using namespace std;

class YouTubeChannel{
public:         
    string Name;
    string OwnerName;
    int SubscribersCount;
    list<string> PublishedVideoTitles;  //list have been included
};

int main(){
    
    YouTubeChannel ytChannel;
    ytChannel.Name="CodeBeauty";
    ytChannel.OwnerName="Saldina";
    ytChannel.SubscribersCount=1800;
    ytChannel.PublishedVideoTitles={"C++ for beginners video 1", "HTML & CSS video 1", "C++ OOP Video 
    1"};  //not working even tho list included
    
    cout<<"Name: "<<ytChannel.Name<<endl;
    cout<<"Name: "<<ytChannel.OwnerName<<endl;
    cout<<"Name: "<<ytChannel.SubscribersCount<<endl;
    
    cout<<"Videos: \n";
    for(string videoTitle: ytChannel.PublishedVideoTitles){
        cout<<videoTitle<<endl;
    }
    
    system("pause>0");
    return 0;
}

Aucun commentaire:

Enregistrer un commentaire