0

Help me, please

segmentation fault (core dump)

3rd Apr 2017, 7:38 PM
murad2000
murad2000 - avatar
3 Réponses
+ 1
check the return type on your public members Edit: also check your private members and check the order you declare them
3rd Apr 2017, 8:45 PM
Orlando
Orlando - avatar
0
There is it, I can't find the mistake #include <iostream> using namespace std; class rcHuman { public: string getMainAtt() { cout<<att[0]<<endl; } string getSecAtt() { cout<<att[1]<<endl; } int getAllAttValue() { for(int x=0; x<4; x++) { cout<<att[x]<<"="; cout<<value[x]<<endl; } return 0; } private: string att[4] { "Strength", "Dexterity", "Constitution", "Willpower" }; int value[4] { rand(), rand(), rand(), rand() }; }; int main() { rcHuman victim; victim.getMainAtt(); victim.getSecAtt(); victim.getAllAttValue(); return 0; }
3rd Apr 2017, 7:43 PM
murad2000
murad2000 - avatar
0
i think little bit confusion in private......
4th Apr 2017, 3:02 PM
Ravi
Ravi - avatar