|
@@ -1,21 +1,24 @@
|
|
|
-#include<string>
|
|
|
|
|
-#include<list>
|
|
|
|
|
-#include<iostream>
|
|
|
|
|
|
|
+#include <iostream>
|
|
|
|
|
+#include <list>
|
|
|
|
|
+#include <string>
|
|
|
|
|
|
|
|
class YoutubeChannel
|
|
class YoutubeChannel
|
|
|
{
|
|
{
|
|
|
private:
|
|
private:
|
|
|
std::string name;
|
|
std::string name;
|
|
|
- std::string ownerName;
|
|
|
|
|
int subscribersCount;
|
|
int subscribersCount;
|
|
|
std::list<std::string> videoList;
|
|
std::list<std::string> videoList;
|
|
|
|
|
|
|
|
|
|
+ protected:
|
|
|
|
|
+ std::string ownerName;
|
|
|
|
|
+ int contentQuality=0;
|
|
|
|
|
+
|
|
|
public:
|
|
public:
|
|
|
- YoutubeChannel(std::string _name, std::string _owner, int _value)
|
|
|
|
|
|
|
+ YoutubeChannel(std::string _name, std::string _owner)
|
|
|
{
|
|
{
|
|
|
name = _name;
|
|
name = _name;
|
|
|
ownerName = _owner;
|
|
ownerName = _owner;
|
|
|
- subscribersCount = _value;
|
|
|
|
|
|
|
+ subscribersCount = 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void subscribe()
|
|
void subscribe()
|
|
@@ -25,11 +28,11 @@ class YoutubeChannel
|
|
|
|
|
|
|
|
void unsubscribe()
|
|
void unsubscribe()
|
|
|
{
|
|
{
|
|
|
- if (subscribersCount>0)
|
|
|
|
|
|
|
+ if (subscribersCount > 0)
|
|
|
subscribersCount--;
|
|
subscribersCount--;
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
|
- std::cout<<"Can't unsubscribe this channel"<<std::endl;
|
|
|
|
|
|
|
+ std::cout << "Can't unsubscribe this channel" << std::endl;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -38,17 +41,56 @@ class YoutubeChannel
|
|
|
videoList.push_back(v);
|
|
videoList.push_back(v);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ void qualityCheck()
|
|
|
|
|
+ {
|
|
|
|
|
+ std::cout<<contentQuality<<std::endl;
|
|
|
|
|
+ if(contentQuality<5)
|
|
|
|
|
+ {
|
|
|
|
|
+ std::cout<<"The quality of "<<name<<" channel is bad."<<std::endl;
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ std::cout<< name << " has great quality!"<<std::endl;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
void show_info()
|
|
void show_info()
|
|
|
{
|
|
{
|
|
|
- std::cout<<"**************************"<<std::endl;
|
|
|
|
|
- std::cout<<"Name: "<<name<<std::endl;
|
|
|
|
|
- std::cout<<"Owner: "<<ownerName<<std::endl;
|
|
|
|
|
- std::cout<<"Subscribers: "<<subscribersCount<<std::endl;
|
|
|
|
|
- std::cout<<"Videos:"<<std::endl;
|
|
|
|
|
- for (std::string _value:videoList)
|
|
|
|
|
|
|
+ std::cout << "**************************" << std::endl;
|
|
|
|
|
+ std::cout << "Name: " << name << std::endl;
|
|
|
|
|
+ std::cout << "Owner: " << ownerName << std::endl;
|
|
|
|
|
+ std::cout << "Subscribers: " << subscribersCount << std::endl;
|
|
|
|
|
+ std::cout << "Videos:" << std::endl;
|
|
|
|
|
+ for (std::string _value : videoList)
|
|
|
{
|
|
{
|
|
|
- std::cout<<"\t"<< _value <<std::endl;
|
|
|
|
|
|
|
+ std::cout << "\t" << _value << std::endl;
|
|
|
}
|
|
}
|
|
|
- std::cout<<"**************************"<<std::endl;
|
|
|
|
|
|
|
+ std::cout << "**************************" << std::endl;
|
|
|
|
|
+ }
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+class CookingYoutubeChannel : public YoutubeChannel
|
|
|
|
|
+{
|
|
|
|
|
+ public:
|
|
|
|
|
+ CookingYoutubeChannel(std::string name, std::string ownerName) : YoutubeChannel(name, ownerName) {}
|
|
|
|
|
+
|
|
|
|
|
+ void practice()
|
|
|
|
|
+ {
|
|
|
|
|
+ std::cout << ownerName << " is practicing cooking..." << std::endl;
|
|
|
|
|
+ std::cout << ownerName << "'s channel has gained 1 content quality point." << std::endl;
|
|
|
|
|
+ contentQuality++;
|
|
|
|
|
+ }
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+class SingingYoutubeChannel : public YoutubeChannel
|
|
|
|
|
+{
|
|
|
|
|
+ public:
|
|
|
|
|
+ SingingYoutubeChannel(std::string name, std::string ownerName) : YoutubeChannel(name, ownerName) {}
|
|
|
|
|
+
|
|
|
|
|
+ void practice()
|
|
|
|
|
+ {
|
|
|
|
|
+ std::cout << ownerName <<" is practicing cooking..." << std::endl;
|
|
|
|
|
+ std::cout << ownerName << "'s channel has gained 1 content quality point." << std::endl;
|
|
|
|
|
+ contentQuality++;
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|