forked from oleoneto/TQF
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUser.h
executable file
·124 lines (75 loc) · 2.39 KB
/
User.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
// User.h
// The Q Factor
// Created by Leo N. on 11/27/16.
// Copyright © 2016 Leo Neto. All rights reserved.
// Applying Inheritance...
#ifndef User_h
#define User_h
#include "Libraries.h"
class User{
private:
std::string name;
std::string ocupation;
int age;
bool admin;
public:
User(){
User::name = "Anonymous";
User::age = 10;
}//constructor
void setName(std::string name){
Manager::name = name;
}
void setAge(int age){
Manager::age = age;
}
std::string getName(){
return name;
}
int getAge(){
return age;
}
void SetManager(){
std::string input;
std::string name;
std::string language;
std::stringstream temporary;
int age;
std::cout << "What is your full name? ";
getline(std::cin, name);
setName(name);
std::cout << "What is your age? ";
getline(std::cin, input);
while(age > 119 & age < 5){
std::cout << "Please enter a valid age: ";
getline(std::cin, input);
temporary << input;
temporary >> age;
setAge(age);
}
std::cout <<""<< std::endl;
std::cout << "You're all set, "<<getName()<<". Now you can manage the program."<<std::endl;
std::cout <<""<< std::endl;
std::cout <<"-------------------------------"<< std::endl;
}
void SetPlayer(Player P){
int age;
std::stringstream temporary;
std::string playername, feedback;
std::cout << "What is the player's name? ";
getline(std::cin, playername);
P.setPlayerName(playername);
std::cout << "How old is the player? ";
getline(std::cin, feedback);
while(age > 119 & age < 5){
std::cout << "Please enter a valid age: ";
getline(std::cin, feedback);
temporary << feedback;
temporary >> age;
P.setPlayerAge(age);
}
std::cout <<""<< std::endl;
std::cout << "Alright, "<<P.getPlayerName()<<" has been set up and is ready to play."<<std::endl;
}//end Introductions()
};
#endif /* User_h */