C
Part 1
Given a structure that store the highest temperature (HighTemp) and the lowest temperature (LowTemp) of a day:
typedef struct {
char DayOfMonth[31]; /* e.g. “May 13”, “July 9” */
int HighTemp; /* the highest temperature of that day */
int LowTemp; /* the lowest temperature of that day */
} DayTemp;
DayTemp Temperature[365];
Temperature is an array of structure DayTemp. Write a function that will return the average of HighTemp for a given number of days (NumberDay) since January 1st. For example, HighAverage( Temperature, 32) will return the average of HighTemp from Jan. 1st until Feb. 1st. The function heading is
int Average ( structure DayTemp Temperature[ ], int NumberDay)
{
}
Part 2
Write a program that
uses a loop to read a series of integer numbers until encountering
a zero. Within the loop, the program calls a function named Sum
that uses the integer number as an argument. The function Sum
calculates and returns the sum of even integers from 2 to that
number.
Sample Run:
Enter a positive integer number ( 0 to stop):
6
This sum of even numbers from 2 to 6 is 12.
Enter a positive integer number ( 0 to stop):
5
This sum of even numbers from 2 to 5 is 6.
Enter a positive integer number ( 0 to stop):
0
`Hey,
Note: Brother in case of any queries, just comment in box I would be very happy to assist all your queries
1)
int Average(struct DayTemp Temperature[],int NumberDay ){
int totalTemperature=0; // will store the total summation of high temperature
// iterate from index 0 to numberday-1
int subscript;
for( subscript=0; subscript<NumberDay;subscript++){
// keep adding the high temperature for that subscript
totalTemperature+= Temperature[subscript].HighTemp;
}
return totalTemperature/NumberDay;// divide the sum by the number of day to get the average
}
2)
#include <stdio.h>
int sum(int n)
{
int i,s=0;
for(i=2;i<=n;i=i+2)
{
s=s+i;
}
return s;
}
int main(){
int num;
printf("Enter a positive integer number ( 0 to stop): ");
scanf("%d",&num);
while(num!=0)
{
printf("This sum of even numbers from 2 to %d is
%d.\n",num,sum(num));
printf("Enter a positive integer number ( 0 to stop): ");
scanf("%d",&num);
}
}

Kindly revert for any queries
Thanks.
C Part 1 Given a structure that store the highest temperature (HighTemp) and the lowest temperature (LowTemp) of a day:...
The following is a program from Starting out with C++ by Toni Gaddis. I am getting the following error messages pertaining to the lines: cin>>month[i].lowTemp; and months[i].avgTemp = (months[i].highTemp + month[i].lowTemp)/2; The error messages read as follows: error C2039: 'lowTemp': is not a member of 'std::basic_string<_Elem,_Traits,_Ax>' and it continues. The second error message is identical. The program is as follows: Ch. 11, Assignment #3. pg. 646. Program #4. //Weather Statistics. //Write a program that uses a structure to store the...
Write a program that uses a two-dimensional array to store the highest and lowest temperatures for each month of the year. You should also have a parallel array to store the names of the 12 months. The program should read the Month's names, and the temperatures from a given input file called temperature.txt. The program should output the highest and lowest temperatures for the year, and the months that correspond to those temperatures. The program must use the following functions:...
********** PLEASE PROVIDE IN JAVA & NEW SET OF ALGORITHM For this lab use the program at the bottom to sort an array using selection sort. Write a selection sort to report out the sorted low values: lowest to highest. Write another to report out the sorted high values – highest to lowest. Last but not least, the program should output all the values in the array AND then output the 2 requested sorted outputs. -----> MY OLD PROGRAM BELOW...
C++
Write a program that prompts the user to enter integers or a sentinel to stop. The program prints the highest and lowest numbers entered, the sum and the average. DO NOT USE ARRAYS, only variables and loops. Write a program the prompts the user to input a positive integer. Keep asking the user until a positive integer is entered. Once a positive integer is entered, print a message if the integer is prime or not. (NOTE: A number is...
Change your C++ average temperatures program to: In a non range-based loop Prompt the user for 5 temperatures. Store them in an array called temperatures. Use a Range-Based loop to find the average. Print the average to the console using two decimals of precision. Do not use any magic numbers. #include<iostream> using namespace std; void averageTemperature() // function definition starts here { float avg; // variable declaration int num,sum=0,count=0; /* 'count' is the int accumulator for number of...
// This program will read in a group of test scores (positive integers from 1 to 100) // from the keyboard and then calculate and output the average score // as well as the highest and lowest score. There will be a maximum of 100 scores. // #include <iostream> using namespace std; float findAverage (const int[], int); // finds average of all grades int findHighest (const int[], int); // finds highest of all grades int findLowest (const int[], int); //...
write a c++ program to find the sum, average, highest, lowest, odd, and even numbers of a list of 10 numbers. apply arrays and functions. ==> NOTE: main program must contain only calls and declarations.
C++, data structure An integer number’s proper divisor is any positive integer that divides the number without remainder and is less than the number. Neither zero nor any negative number is a proper divisor. Write a function returns true if its second parameter is a proper divisor of its first parameter. The function’s prototype is bool properDivisor(int number, int candidate) Write a function that returns the sum of a number’s proper divisors. The function’s prototype is int properDivisorSum(int number); Use...
Please write a C++ program that will accept 3 integer numbers from the user, and output these 3 numbers in order, the sum, and the average of these 3 numbers. You must stop your program when the first number from the user is -7. Design Specifications: (1) You must use your full name on your output statements. (2) You must specify 3 prototypes in your program as follows: int max(int, int, int); // prototype to return maximum of 3 integers...
in c++ language 1.Re-write the following for loop statement by using a while loop statement: int sum = 0; for(int i=0;i<=1000;i++){ sum+=i; } 1 (b). Following is the main () function of a program. The program asks a user to enter 150 integers and print the largest integer user entered. int main() { int score, highest; //missing portion of the program return 0; } 1(c). Find the missing portion of the following code, so the...