View Single Post
Old 04-19-2005, 02:04 AM   #5 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,726
redhead is on a distinguished road
Here is one in C, try to compare it with yours and see where your assignments went wrong.
Code:
#include <stdio.h>

typedef struct hurricane
{
  char hurricane_name[10];
  int category;
  int max_windspeed;
  char month[10];
  int day;
  char landfall[20];
}hurricane;


int main (void)
{
  hurricane h[4];
  strcpy(h[0].hurricane_name,"Charley");
  h[0].category = 4;
  h[0].max_windspeed = 145;
  strcpy(h[0].month, "August");
  h[0].day = 13;
  strcpy(h[0].landfall, "Charlotte Co.");

  /* see if it was filled correct */
  printf("Hurricane name: %s\n", h[0].hurricane_name);
  printf("Hurricane category: %d\n", h[0].category);
  printf("Hurricane max_windspeed: %d\n", h[0].max_windspeed);
  printf("Hurricane month: %s\n", h[0].month);
  printf("Hurricane day: %d\n", h[0].day);
  printf("Hurricane landfall: %s\n", h[0].landfall);
  return 0;
}
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote