Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<string>
- #include <fstream>
- #include <algorithm>
- #include <iomanip>
- #include<vector>
- using namespace std;
- class User{
- private:
- string id_user;
- string groupName;
- string subGroupName;
- public:
- static string groupNameStat;
- User()
- {
- id_user= "";
- groupName = "";
- subGroupName = "";
- }
- User(string idnum, string group, string subgroup)
- {
- id_user = idnum;
- groupName = group;
- subGroupName = subgroup;
- }
- string getId()
- {
- return id_user;
- }
- string getGroupName()
- {
- return groupName;
- }
- string geSubGroup()
- {
- return subGroupName;
- }
- bool operator <(User p)
- {
- if (id_user.length()<p.id_user.length()) return true;
- }
- bool operator ==(User p)
- {
- if (p.id_user == id_user){ return true; }
- else return false;
- }
- friend ostream& operator <<(ostream& fp, User p)
- {
- fp << " User ID : " << p.id_name << " Group Name : " << p.groupName <<
- "Subgroup Name:" << p.geSubGroup << endl;
- return fp;
- }
- friend istream& operator >>(istream& fp, User p)
- {
- fp >> p.id_user >> p.groupName >> p.subGroupName;
- }
- };
- class SocialNet{
- private:
- string networkName;
- vector<User>users;
- public:
- SocialNet(string fileName)
- {
- fstream fp;
- string buff;
- int pos;
- int counter = 0;
- fp.open(fileName);
- if (fp.is_open())
- {
- while (getline(fp, buff))
- if (counter != 0)
- {
- pos = buff.find(" ");
- users.push_back(User(buff.substr(0, pos), stoi(buff.substr(pos))));
- }
- else{
- networkName = buff;
- counter++;
- }
- }
- fp.close();
- }
- };
- int main()
- {
- int choice;
- do
- {
- cout << endl
- << " 1. Suzdavane na obekt.\n"
- << " 2 - Story.\n"
- << " 4 - Help.\n"
- << " 5 - Exit.\n"
- << " Enter your choice and press return: ";
- cin >> choice;
- switch (choice)
- {
- case 1:
- //code to start the game
- break;
- case 2:
- //code to make score for this game to count how many times u win the game
- break;
- case 3:
- //code to make option for the game
- break;
- case 4:
- //code to help the user like give him
- //extra information about the mode and the controller
- break;
- case 5:
- cout << "End of Program.\n";
- break;
- default:
- cout << "Not a Valid Choice. \n"
- << "Choose again.\n";
- break;
- }
- } while (choice != 5);
- return 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement