1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
|
#include <iostream>
using namespace std;
#include <math.h>
void Hello(void);
void InputData(int Day[], double HighTemp[], double RecordHighTemp[],
int Year[], double RelativeHumidity[]);
void InputDataKeyboard(int Day[], double HighTemp[], double RecordHighTemp[],
int Year[], double RelativeHumidity[]);
void main(void)
{
int Day[100];
double HighTemp[100];
double RecordHighTemp[100];
int Year[100];
double RelativeHumidity[100];
Hello();
InputData(Day, HighTemp, RecordHighTemp,
Year, RelativeHumidity);
DisplayMenu();
}
void Hello(void)
{
cout << "Hello, welcome to this program!" << endl << endl
<< "This program is intended to display"
<< "specific data regarding weather." << endl
<< endl << endl;
}
void InputData(int Day[], double HighTemp[], double RecordHighTemp[],
int Year[], double RelativeHumidity[])
{
int choice;
cout << "Do you want to enter the data from the keyboard or from a file?"
<< endl
<< "\t Enter (1), to enter data from the keyboard." << endl
<< "\t Enter (2), to load a file." << endl << endl;
cin >> choice;
if (choice == 1)
InputDataKeyboard(Day, HighTemp, RecordHighTemp,
Year, RelativeHumidity);
else
cout << "Loading....." << endl;
}
void InputDataKeyboard(int Day[], double HighTemp[], double RecordHighTemp[],
int Year[], double RelativeHumidity[])
{
int ix;
ix=0;
cout << endl << "Enter in your five record values." << endl;
cout << "\tEnter your data in this order." << endl;
cout << "\t\tDay (Counting from the beginning of the year; For Example:"
<< endl << "\t\tFebruary 2 is 33)" << endl;
cout << "\t\tThe High Temperature (in degrees Fahrenheit)" << endl;
cout << "\t\tThe Record High Temperature. (also in Fahrenheit)" << endl;
cout << "\t\tThe Year the Record High Temperature was recorded." << endl;
cout << "\t\tThe Relative Humidity (in percent)" << endl;
cout << "End by inserting a \"0\" (zero) for the day of the year."
<< endl << endl;
do
{
cout << "Enter the Day." << endl;
cin >> Day[ix];
cout << "Enter the High Temp." << endl;
cin >> HighTemp[ix];
cout << "Enter the Record High Temp." << endl;
cin >> RecordHighTemp[ix];
cout << "Enter the Year of Record High Temp." << endl;
cin >> Year[ix];
cout << "Enter the Relative Humidity" << endl;
cin >> RelativeHumidity[ix];
++ix;
}
while(Day[ix] != 0);
}
|