No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
The do...while loop works fine when i key in only single character, however if i key in multiple characters, the default statement is executed infinitely. I think the problem lies in cin >> int?, i need some help in modifying the code, thx [CODE] bool rightanswer = true; do { … |
|
for example [CODE] cout << "User Name: "; getline( cin, s.userName); cout << "Gender: "; cin >> s.gender();[/CODE] but i can't use s.userName or s.gender, because they are protected value(incapsulation), how do i use setUserName(string)/ setGender(char) together with getline/cin? |
|
This is just part of my code. For some unknown reason, the value of staff is correct after using copy constructor, however, once it goes out of the loop, 2 of s value's turn into -858993460, other values stay fine, look at the red lines part of the code [CODE] … |