#C help!

16 messages · Page 1 of 1 (latest)

sacred caveBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

waxen valley
#

After each call to survey_response_handler, you need to increment respondent_index. You also do not have 38 respondents, you only have 5, each of which has 38 responses

blazing rapids
#

i will try to do that rn

sacred caveBOT
#

@blazing rapids Has your question been resolved? If so, type !solved :)

blazing rapids
#

i adjusted my read and process function to increment respondent_index. when i try and run the input it just shows a bunch of new lines.

waxen valley
#

may i see the new code?

blazing rapids
#

in read and process

'''
else {
survey_response_handler(line, survey_response,respondent_index);
respondent_index++;
}
"'
in main to print it out

'''
for (int i = 0; i < 6; i++) {
for (int j = 0; j < 10 ; j++) {
printf("%s\n", survey_response[j][i]);
}
}
'''
i put j<10 as a placeholder for now just to see what it would output

#

wait how do i show it appear as code im sorry 😭

waxen valley
#

try printf("%s\n", survey_response[i][j]);

blazing rapids
#

fortable with learning computing concepts.
ng computing concepts.
s.

// this is the output when for the for loop

waxen valley
#

heh... here is my way to print results:

    // Print all responses for all respondents
    for (int i = 0; i < 5; i++) {
        printf("Respondent %d responses:\n", i + 1); 
        for (int j = 0; j < 38; j++) {
            if (survey_response[i][j][0] != '\0') {  // Check if response is populated
                printf("  Response %d: %s\n", j + 1, survey_response[i][j]);
            }
        }
        printf("\n");  // Add a newline after each respondent's responses
    }   
blazing rapids
#

!solved

sacred caveBOT
#

Thank you and let us know if you have any more questions!

This thread is now set to auto-hide after an hour of inactivity

#

@blazing rapids

Please Do Not Delete Posts!

Please don't delete forum posts. They can be helpful to refer to later and other members can learn from them. In the future you can use !solved to close a post and mark a post as solved.

blazing rapids
#

ok