C Program

profileBob_Usher

   

Typhoon warning system assignment for one extra credit. 

Measure the distance from Typhoon center to the city?

You need to know:

1. struct, typrdef, float, array of struct, int, char

2. for/while/ or do {}while

3. if. if else,

4. fopen(), fclose(), fscanf() Program outline:

NOTE: We use longitude and latitude as if x and y in 2D space!

1. Create an array of CITY data structure => cities[ 80 or so ]

2. Read city data from “longlat.txt” into cities[i] 3.

Loop Begin:

read “path.txt” one line at a time. The 1 st line is:

1.0 0.7 25.0 135.0 0 June 30

This reads (See File format below):

a) very strong wind area is within radius 1 from the typhoon center

b) terribly strong wind and rain is within radius 0.7 from the typhoon center

c) typhoon center latitude is 25.0

d) typhoon center longitude is 135.0

e) 24 hour clock time is 0 c’clock

f) month is June

g) date is 30

Now, go through cities [ ] to find out if a city is within the very strong wind area or terribly strong wind and rain area.

Printing example: July 2, 1200: Kumamoto strong wind Loop End

  

File format of “path.txt”: a b c d e f g

a: very strong wind area radius

b: terribly strong wind and rain radius c: typhoon center latitude

d: typhoon center longitude e: 24 hour clock time

f: month g: date

File data:

  

1.0


0.7


25.0


135.0


0


June


30

 

1.0


0.7


26.0


134.4


6


July


1

 

1.0


0.7


27.0


134.0


12


July


1

 

0.9


0.7


28.0


133.0


18


July


1

 

0.9


0.7


29.0


132.5


24


July


1

 

0.9


0.6


30.0


132.0


6


July


2

 

0.9


0.6


30.6


132.0


12


July


2

 

0.9


0.6


31.5


132.0


18


July


2

.......

File format of “longlat.txt” City-name latitude longitude

File data:

Tokyo 35.685 139.751389

Ōsaka 34.683333 135.516667

Yokohama 35.433333 139.65

Nagoya 35.183333 136.9

Fukuoka 33.6 130.416667

Sapporo 43.066667 141.35

Sendai 38.266667 140.866667

Hiroshima 34.4 132.45

Kyōto 35.016667 135.75

Kōbe 34.683333 135.183333

Shinkawasaki 35.550193 139.670327

Hamamatsu 34.7 137.733333

Zahana 26.166667 127.666667

Okayama 34.65 133.933333

Kumamoto 32.783333 130.733333

Shizuoka 34.983333 138.383333

Utsunomiya 36.566667 139.883333

Nagano 36.65 138.183333

Hachiōji 35.655833 139.323889

Niigata 37.9 139.0

Kagoshima 31.566667 130.55

Kanazawa 36.6 136.616667

Ōtsu 35.0 135.866667

Mitsuhama 33.85 132.716667

Tsu 34.733333 136.516667

Ōita 33.233333 131.6

Tokushima 34.066667 134.566667

Wakayama 34.233333 135.166667

Nagasaki 32.75 129.883333

Gifu 35.433333 136.783333

Iwaki 37.05 140.883333

Asahikawa 43.767778 142.370278

Mito 36.35 140.45

Maebashi 36.4 139.083333

Kawagoe 35.908611 139.485278

Kōchi 33.55 133.533333

Takamatsu 34.333333 134.05

Toyama 36.7 137.216667

Miyazaki 31.916667 131.416667

Akita  39.716667 140.1

Hakodate 41.775833 140.736667

Aomori 40.816667 140.733333

Morioka 39.7 141.15

Fukushima 37.75 140.466667

Yamagata 38.233333 140.366667

Fuku 36.04803 136.188686

Shinkai 33.956834 130.984615

Ashino 43.015176 144.397259

Kōfu 35.666667 138.566667

Kure 34.23222 132.566583

Hiraokamachi 40.609461 140.453279

Takaoka 36.75 137.016667

Matsue 35.483333 133.05

Muroran 42.317222 140.988056

Tottori 35.5 134.233333

Otaru 43.189444 141.002222

Kitami 43.803056 143.890833

Sakata 38.916667 139.855

Tsuruoka 38.721667 139.821667

Naka-maizuru 35.466667 135.366667

Kasano 31.390993 130.903752

Onagawa Chō 38.444912 141.432692

Matsuyama 33.833333 132.766667

Inuotose 40.601757 141.326615

Saitama 35.9 139.65

Hirado 33.368533 129.552469

Naha 26.216667 127.683333

Kozakai-chō 34.8 137.358889

Nara 34.683333 135.833333

Furudate 40.529338 141.305532

Fukui 36.066667 136.216667

Uchimaru 40.514368 141.492673

Saga 35.6 140.116667

Yawatahama-shi 33.488334 132.354167

Yamaguchi 35.6 140.116667

Chiba 35.6 140.116667

Ikata-chō 33.488334 132.354167

  • Posted: a year ago
  • Due: 
  • Budget: $10
Answers 3
  • C programming
    Answer rating:5Stars out of1ratings

Purchase the answer to view it

blurred-text

Purchase the answer to view it

blurred-text

    Purchase the answer to view it

    blurred-text