i can't figure out where to even start with this.

You will generate a set of data simulating (unrealistically) peak daily temperatures over a 100-day period. Your program will have the following parts and perform the following operations:

(1) Two initially empty array with size 100 and data type "double". One will store temperatures in degrees Fahrenheit and the other will store temperatures in degrees Celcius.

(2) Using a for loop, populate the first array with double precision values representing temperatures in degrees Fahrenheit. These values should be generated using the random number genrator, and should be between 70.0 and 100.0 degrees. Important: DO NOT use the srand( ) function. I want everyone to generate the same 100 random numbers. The correctness of your final answers will count towards your grade!

(3) Once the first array is populated, use another for loop to convert the values to degrees Celcius. The conversion is C=(5/9)*(F - 32). These converted values should be stored sequentially in the second array.

(4) Using the statistics library and its header file (stat_lib.ccp and stat_lib.h), calculate the minimum, maximum, mean, and standard deviation of the temperature in degrees Celcius. Output these results to the screen.

The statistics library source and header files are posted in .rtf format. You will have to copy and paste them into appropriate files in Visual C++. Remember, you must create files called stat_lib.ccp and stat_lib.h, and include the header file before your main function using the #include statement.


OK

Recommended Answers

All 4 Replies

I wan to say two things :

1) Read the forum rules...And let the thread head specify the topic rather than "Oh please help me.." or "Do my homework for free you dumbo's..."

2)The question is quite clear try something and then come back.
Even the looping information is given very clearly... We are here for help not as "Online free homework code portal" .

And for your start :

// Headers

int main()
{
//Code the points
}

I wan to say two things :

1) Read the forum rules...And let the thread head specify the topic rather than "Oh please help me.." or "Do my homework for free you dumbo's..."

2)The question is quite clear try something and then come back.
Even the looping information is given very clearly... We are here for help not as "Online free homework code portal" .

The instructions seem pretty clear to me. Just do them one at a time, from top to bottom. Do the first requirement, compile, fix error messages, then when that is finished do the next requirement.

I'm not doing it all for you but should be more than enough for you to get started.

#include stat_lib.h //assuming you have created it
#include <cstdlib>
#include <iostream>
#include <math.h>

using namespace std;

int main()
{
	//Step(1) 
	double far[100];
	double cel[100];
	
	//Step(2)
	for(int i=0;i<100;i++)
	{
		far[i] = rand() % 70 + 100; 
	}
	
	//For step(3) you do the same as step two but with
	//the loop converting to Celcius.
	
	return 0;
}

For step four consider making functions as follows in your stat_lib.h:

#ifndef stat_lib_h
#define stat_lib_h

int median(//input parameters)
{
	using namespace std;

	//...Some code to find the median
	
	return //return the median;
}

#endif
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.