Common array operations
📖 Scenario: You are working with a list of daily temperatures recorded over a week. You want to perform some common operations on this list to understand the data better.
🎯 Goal: Build a simple C++ program that stores daily temperatures in an array, calculates the average temperature, finds the highest temperature, and prints the results.
📋 What You'll Learn
Create an array with exactly 7 integer temperature values
Create a variable to hold the sum of temperatures
Use a for loop with index variable
i to iterate over the arrayCalculate the average temperature as a float
Find the highest temperature using a variable
maxTempPrint the average and highest temperature exactly as shown
💡 Why This Matters
🌍 Real World
Arrays are used to store collections of data like temperatures, sales numbers, or scores. Knowing how to process arrays helps analyze and summarize data.
💼 Career
Many programming jobs require working with arrays and loops to handle lists of information efficiently.
Progress0 / 4 steps