Array of a type
From: Profetas (xuxu_18_at_yahoo.com)
Date: 05/02/04
- Next message: Joona I Palaste: "Re: Array of a type"
- Previous message: Mark McIntyre: "Re: socket returning gibbarish"
- Next in thread: Joona I Palaste: "Re: Array of a type"
- Reply: Joona I Palaste: "Re: Array of a type"
- Reply: Al Bowers: "Re: Array of a type"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 02 May 2004 11:37:04 -0400
I have to do a program that determine the biggest
number in the month
I have to use enum
so I was wondering can I declare an array of a type
like
#include <stdio.h>
int main()
{
int h_rain_fall, n_months, i;
enum months {jan=23, feb=19, apr=27, mar=38, may=33, jun=24, jul=20,
aug=18, sep=26, oct=30, nov=26, dec=22};
string a_months[jan,feb,apr,mar,may,jun,jul,aug,sep,oct,nov,dec];
n_months = 12;
i = 0;
for(i=n_months; i!=0 ; i--) {
printf("teste %d", a_months[i]);
if (a_months[i] > h_rain_fall)
{
h_rain_fall = a_months[i];
}
else
{
//skip
}
}
printf("The highst rain fall is %d",h_rain_fall);
return(0);
}
Thanks Profetas
- Next message: Joona I Palaste: "Re: Array of a type"
- Previous message: Mark McIntyre: "Re: socket returning gibbarish"
- Next in thread: Joona I Palaste: "Re: Array of a type"
- Reply: Joona I Palaste: "Re: Array of a type"
- Reply: Al Bowers: "Re: Array of a type"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|