تم الحل ✓
categoryبرمجة وتطوير البرمجيات
schoolبكالوريوس
event_available2026-07-14
السؤال
Transcribed Image Text:
values of the parameters and the result of the calculation.
Making a Difference
7.32 (Polling) The Internet and the web are enabling more people to network, join a cause, voice
opinions, and so on. The U.S. presidential candidates in 2008 used the Internet intensively to get
out their messages and raise money for their campaigns. In this exercise, you'll write a simple polling
program that allows users to rate five social-consciousness issues from 1 (least important) to 10
(most important). Pick five causes that are important to you (e.g., political issues, global environ-
mental issues). Use a one-dimensional array topics (of type char *) to store the five causes. To sum-
marize the survey responses, use a 5-row, 10-column two-dimensional array responses (of type
332
Chapter 7 C Pointers
int), each row corresponding to an element in the topics array. When the program runs, it should
ask the user to rate each issue. Have your friends and family respond to the survey. Then have the
program display a summary of the results, including:
7.33
a) A tabular report with the five topics down the left side and the 10 ratings across the
listing in each column the number of ratings received for each topic.
b) To the right of each row, show the average of the ratings for that issue.
top,
c) Which issue received the highest point total? Display both the issue and the point total.
d) Which issue received the lowest point total? Display both the issue and the point total.
(Carbon Footprint Calculat
isanch14@greenfield-southtexascollege edu chapter
Fig 7.32: fig07_32.0
Polling
#include <stdio.h>
#include <stdlib.h>
int main()
char *topics [5]:
"Political Issues";
topics [0]
topics [1]
"Global Warming";
topics [2]
topics [3]
"Smuggling";
"Corruption";
topics [4] "Women Safety";
int ratings [5] [10];
int ratings_count = 0;
while (ratings_count < 10) {
printf("Welcome, please select a topic to rate d", &ratings_count);
for (int i = 0; i < 5; i++) {
}
}
printf("Give your rating for ts", topics[i]);
scanf("%d", &ratings [ratings_count] [1]);
ratings_count++;
printf("Survey Completed");
printf("Survey Results");
for (int i=0; i < 5; i++); {
int avg = (ratings [1] [0] + ratings [1] [1] + ratings [1] [2] + ratings [1] [3]
ratings [i] [4] + ratings [1] [5] + ratings [1] [6] + ratings [i][7]
ratings [1] [8] + ratings [1] [9]);
printf("s
%d %d %d %d %d %d %d id %d %d %d", topics [i],
Gratings [1][0], &ratings [1] [1],
Gratings [i][5],
avg / 10);
ratings [1] [2],
ratings[i] [6],
ratings [1] [7],
ratings [i] [3],
ratings[i]]8],
ratings [1][4],
ratings[i][9],
}
return 0;
check_circle الجواب — حل مفصل خطوة بخطوة
hourglass_top
🔒
الحل الكامل متاح للمشتركين
اشترك في أرشيف الأسئلة لعرض هذا الحل وآلاف الحلول المفصلة خطوة بخطوة من معلمين معتمدين.