Pointers and Arrays.

cpp.sh/6eukj




link above is my code i'm not sure what i did wrong but the personality.out is print not correctly. Please help thank you

Here is the personality.txt

Betty Boop
BABAAAABAAAAAAABAAAABBAAAAAABAAAABABAABAAABABABAABAAAAAABAAAAAABAAAAAA
Snoopy
AABBAABBBBBABABAAAAABABBAABBAAAABBBAAABAABAABABAAAABAABBBBAAABBAABABBB
Bugs Bunny
aabaabbabbbaaaabaaaabaaaaababbbaabaaaabaabbbbabaaaabaabaaaaaabbaaaaabb
Daffy Duck
BAAAAA-BAAAABABAAAAAABA-AAAABABAAAABAABAA-BAAABAABAAAAAABA-BAAABA-BAAA
The frumious bandersnatch
-BBaBAA-BBbBBABBBBA-BaBBBBBbbBBABBBBBBABB-BBBaBBABBBBBBB-BABBBBBBBBBBB
Minnie Mouse
BABA-AABABBBAABAABA-ABABAAAB-ABAAAAAA-AAAABAAABAAABAAAAAB-ABBAAAAAAAAA
Luke Skywalker
bbbaaabbbbaaba-BAAAABBABBAAABBAABAAB-AAAAABBBABAABABA-ABBBABBABAA-AAAA
Han Solo
BA-ABABBB-bbbaababaaaabbaaabbaaabbabABBAAABABBAAABABAAAABBABAAABBABAAB
Princess Leia
BABBAAABBBBAAABBA-AAAABABBABBABBAAABAABAAABBBA-AABAABAAAABAAAAABABBBAA

this is the output should be:

Output file personality.out (Checkpoint output):

Betty Boop: 1 17 18 18 9 3 2 2

Snoopy: 7 11 14 6 3 9 6 14

Bugs Bunny: 8 11 17 9 2 9 3 11

Daffy Duck: 0 16 16 17 10 1 4 1

The frumious bandersnatch: 1 1 5 4 6 19 15 14

Minnie Mouse: 3 13 13 18 6 5 6 1

Luke Skywalker: 1 7 14 15 8 11 5 5

Han Solo: 2 9 11 15 8 9 9 5

Princess Leia: 2 10 9 19 8 10 9 1

Output file personality.out (Final output):

Betty Boop: [90, 15, 10, 10] = ISTJ

Snoopy: [30, 45, 30, 70] = ESTP

Bugs Bunny: [20, 45, 15, 55] = ESTP

Daffy Duck: [100, 6, 20, 6] = ISTJ

The frumious bandersnatch: [86, 95, 75, 78] = INFP

Minnie Mouse: [67, 28, 32, 5] = ISTJ

Luke Skywalker: [89, 61, 26, 25] = INTJ

Han Solo: [80, 50, 45, 25] = IXTJ

Princess Leia: [80, 50, 50, 5] = IXXJ


Last edited on
I thought I initialized size in main function
Yes, I misread your post but didn't delete my post fast enough. Ignore me ;)
Can you help me what wrong with it?
You need to add "9" as the first line of personality.txt. When I do that, the program seems to work.
Topic archived. No new replies allowed.