Это мой код:
Код: Выделить всё
#include
#include
int main(){
// I defined my variables before entering the do while loop
int invalid_temps {0};
double valid_temps {0.0};
int temp {};
double average {0.0};
double sum_of_temps {0.0};
/* I need the prompt to show at least once, so I used a do while loop.
I also just wanted some practice using the do while loop. */
do {
std::cout > temp;
/* I used an if statement keep track of valid and invalid outputs. It also helped me manipulate what numbers would be included in the average. */
if (temp >= -30 && temp
Подробнее здесь: [url]https://stackoverflow.com/questions/78169008/nan-error-when-finding-an-average-in-c[/url]