how to display max min mean... together, cause i tried to find the solution
this file my menu.c
#include<stdio.h>
#include<conio.h>
extern int Jan13Max,Jan13Min,Jan13Mean,Jun13Max,Jun13Min,Jun13Mean[]; //array transfer from data.c files
void showMenu(void) // showMenu
{
puts("A: The Maximum,Minimum and Mean temperatures for any selected day");
puts("B: The Highest temperature reached for the selected month");
puts("C: The mean temperature for the selected month");
puts("Q: Exit temperature for reading");
putch('\n');
}
void dispMaxMinMeanTemp(void)
{
int i;
int day=0;
int month=0;
{
printf("What Month do you want to display\n"); // 1. prompt -- ask user what month he wants
scanf("%d",&month); // 2. read the month that the user enters into a variable.
printf("What day do you want to display (1-31)\n"); // 3. prompt -- ask user what day he wants to display
scanf("%d",&day); // 4. read the day that the user enters into a variable.
printf("Max, Min and Mean the temperatures are :"); // 5. use the day, read the Max, Min and Mean array to extract temperatures.
printf("%5d",month); // 6. print out the temperatures.
} putch('\n');
}
int Jan13Max[31]={31.4,30.5,32.0,30.5,31.8,32.5,35.2,32.7,32.1,30.0,31.0,31.4,30.8,31.0,30.9,30.3,30.7,32.0,24.8,25.4,31.1,28.2,30.9,30.7,30.7,30.7,31.0,31.0,31.3,31.2,31.5};
int Jan13Min[31]={23.9,23.1,24.2,25.0,25.2,25.2,25.2,21.6,22.4,25.0,25.9,25.4,23.6,25.4,25.9,26.1,25.2,24.3,22.6,23.6,24.1,23.7,24.6,25.4,24.3,25.0,24.7,25.3,25.2,24.9,25.2};
int Jan13Mean[31]={27.0,27.0,26.8,27.3,27.5,27.7,29.1,27.1,26.2,27.0,27.7,27.5,26.3,27.5,27.6,27.4,27.5,26.9,23.7,24.4,27.1,25.8,27.0,27.3,27.2,27.2,27.4,27.5,27.5,27.5,27.8};
int Jun13Max[30]={33.0,32.4,32.5,30.6,33.4,32.4,33.7,32.3,29.6,32.7,32.3,33.2,33.0,32.5,33.6,32.5,33.2,34.2,34.5,33.9,34.0,33.3,32.9,33.4,33.7,30.0,32.4,32.1,32.0,29.7};
int Jun13Min[30]={22.6,25.6,24.1,25.2,22.9,24.6,25.7,25.2,24.8,25.2,24.9,27.1,27.1,28.0,27.8,25.8,25.9,27.0,26.8,26.8,27.0,27.5,27.5,28.2,27.2,23.0,26.3,25.8,26.6,23.8};
int Jun13Mean[30]={27.2,28.7,28.1,27.3,27.2,28.4,28.5,27.7,27.7,28.9,29.3,29.8,29.8,29.9,30.0,29.6,29.2,30.4,30.5,29.9,30.1,30.1,30.0,30.2,29.5,27.7,28.9};
char userlnput;
/* char userPwd[7];
int tries,status;
while(1)
{
status=0;
tries=0;
printf("Enter 6 digi password.\n");
do
{
getPwd(userPwd);
status=chkPwd(userPwd);
if(status==0); puts("incorrect password, try again.\n");
}while(status==0);
do
{
showMenu();d FA
(userlnput)=getch();
*/
showMenu();
(userlnput)=getch();
switch (userlnput)
{
case 'a': case 'A': dispMaxMinMeanTemp(); break;
//case 'b': case 'B': disphighestTemp(); break;
//case 'c': case 'C': dispMeanTemp(); break;
case 'q': case 'Q': userlnput='q'; break;
default: puts("You selected an invalid option");
}
}
i want to display which month and which day.. can anybody help me my programming works? and i need to display max,min,mean together, i appreciate your helps
data.cpp: You're trying to initialize int arrays with double values. Values are going to be truncated.
I see no implementation for dispMaxMinMeanTemp ().
PLEASE USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post. http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.