Hey guys,
I know in C you can use do-while for single integers and characters but I was wondering if it is possible to use the same do-while feature for whole groups of numbers?
EDIT: Okay i am really confused as to what this homework question is asking. But i think i get the question, just don't know what function will work. It wants the user to input several temperatures. The program will then take the temperatures and check them with three categories. These three categories are divided by how hot or cold it is. 85 or higher is 1, 60-84 is another, and less than 60 is another. I think instead of printing out the numbers again, it will just tally the temperatures into each category and then give the total number for each category at the end. Does that make any sense? Can anyone tell me where to start?
Okay guys, I've got this so far:
#include <stdio.h>
int main (void)
{
int temp;
double average;
int hot_days, pleasant_days, cold_days;
char x;
hot_days = 0;
pleasant_days = 0;
cold_days = 0;
printf("Enter the temperatures you wish to be categorized, each followed by a space.\n\n");
do
{
scanf("%d", &temp);
if (temp >= 85)
hot_days++;
if (temp < 60)
cold_days++;
else pleasant_days++;
{
while(x != 'q')
printf("Insert 'q' and press return.");
scanf("%c", &x);
printf("\n*************\n\nHot Days: %d\nPleasant Days: %d\nCold Days: %d\n",
hot_days, pleasant_days, cold_days);
return 0;
}