SlideShare a Scribd company logo
1 of 12
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

More Related Content

More from corbing9ttj

1. If I wanted to test a certain chemical to see if it made mice run.docx
1. If I wanted to test a certain chemical to see if it made mice run.docx1. If I wanted to test a certain chemical to see if it made mice run.docx
1. If I wanted to test a certain chemical to see if it made mice run.docx
corbing9ttj
 
1. Identify a community or aggregate you are currently involved wi.docx
1. Identify a community or aggregate you are currently involved wi.docx1. Identify a community or aggregate you are currently involved wi.docx
1. Identify a community or aggregate you are currently involved wi.docx
corbing9ttj
 
1. How many time zones are there across the world2. Which map wou.docx
1. How many time zones are there across the world2. Which map wou.docx1. How many time zones are there across the world2. Which map wou.docx
1. How many time zones are there across the world2. Which map wou.docx
corbing9ttj
 
1. How has the economic geography of this region changed over the .docx
1. How has the economic geography of this region changed over the .docx1. How has the economic geography of this region changed over the .docx
1. How has the economic geography of this region changed over the .docx
corbing9ttj
 
1. If you adopt the _______ perspective, youll reject an emphasis o.docx
1. If you adopt the _______ perspective, youll reject an emphasis o.docx1. If you adopt the _______ perspective, youll reject an emphasis o.docx
1. If you adopt the _______ perspective, youll reject an emphasis o.docx
corbing9ttj
 
1. Having been attacked and bitten by a German shepherd, Sam reacts .docx
1. Having been attacked and bitten by a German shepherd, Sam reacts .docx1. Having been attacked and bitten by a German shepherd, Sam reacts .docx
1. Having been attacked and bitten by a German shepherd, Sam reacts .docx
corbing9ttj
 
1. High-level formatting in Windows XP, Vista, and 7 uses which tool.docx
1. High-level formatting in Windows XP, Vista, and 7 uses which tool.docx1. High-level formatting in Windows XP, Vista, and 7 uses which tool.docx
1. High-level formatting in Windows XP, Vista, and 7 uses which tool.docx
corbing9ttj
 

More from corbing9ttj (20)

1. If I wanted to test a certain chemical to see if it made mice run.docx
1. If I wanted to test a certain chemical to see if it made mice run.docx1. If I wanted to test a certain chemical to see if it made mice run.docx
1. If I wanted to test a certain chemical to see if it made mice run.docx
 
1. Identify a community or aggregate you are currently involved wi.docx
1. Identify a community or aggregate you are currently involved wi.docx1. Identify a community or aggregate you are currently involved wi.docx
1. Identify a community or aggregate you are currently involved wi.docx
 
1. Identify and describe the steps of the scientific method. Which o.docx
1. Identify and describe the steps of the scientific method. Which o.docx1. Identify and describe the steps of the scientific method. Which o.docx
1. Identify and describe the steps of the scientific method. Which o.docx
 
1. How many time zones are there across the world2. Which map wou.docx
1. How many time zones are there across the world2. Which map wou.docx1. How many time zones are there across the world2. Which map wou.docx
1. How many time zones are there across the world2. Which map wou.docx
 
1. How has society responded to coastal changes initiated by sand tr.docx
1. How has society responded to coastal changes initiated by sand tr.docx1. How has society responded to coastal changes initiated by sand tr.docx
1. How has society responded to coastal changes initiated by sand tr.docx
 
1. How has the economic geography of this region changed over the .docx
1. How has the economic geography of this region changed over the .docx1. How has the economic geography of this region changed over the .docx
1. How has the economic geography of this region changed over the .docx
 
1. Important nurses of the 19th century are often overshadowed by Ni.docx
1. Important nurses of the 19th century are often overshadowed by Ni.docx1. Important nurses of the 19th century are often overshadowed by Ni.docx
1. Important nurses of the 19th century are often overshadowed by Ni.docx
 
1. In what ways did the Columbian Exchange impact the Americas, .docx
1. In what ways did the Columbian Exchange impact the Americas, .docx1. In what ways did the Columbian Exchange impact the Americas, .docx
1. In what ways did the Columbian Exchange impact the Americas, .docx
 
1. How did the conditions of life among descendants of African Slave.docx
1. How did the conditions of life among descendants of African Slave.docx1. How did the conditions of life among descendants of African Slave.docx
1. How did the conditions of life among descendants of African Slave.docx
 
1. If you adopt the _______ perspective, youll reject an emphasis o.docx
1. If you adopt the _______ perspective, youll reject an emphasis o.docx1. If you adopt the _______ perspective, youll reject an emphasis o.docx
1. If you adopt the _______ perspective, youll reject an emphasis o.docx
 
1. How are information systems transforming business and what is the.docx
1. How are information systems transforming business and what is the.docx1. How are information systems transforming business and what is the.docx
1. How are information systems transforming business and what is the.docx
 
1. How can Fiedlers theory of the least preferred coworker help man.docx
1. How can Fiedlers theory of the least preferred coworker help man.docx1. How can Fiedlers theory of the least preferred coworker help man.docx
1. How can Fiedlers theory of the least preferred coworker help man.docx
 
1. How would you respond if you were diagnosed with HIV Address hop.docx
1. How would you respond if you were diagnosed with HIV Address hop.docx1. How would you respond if you were diagnosed with HIV Address hop.docx
1. How would you respond if you were diagnosed with HIV Address hop.docx
 
1. How does the Occupational Safety and Health Administration (OSH.docx
1. How does the Occupational Safety and Health Administration (OSH.docx1. How does the Occupational Safety and Health Administration (OSH.docx
1. How does the Occupational Safety and Health Administration (OSH.docx
 
1. How did society view Alfred Wegener’s continental drift theory.docx
1. How did society view Alfred Wegener’s continental drift theory.docx1. How did society view Alfred Wegener’s continental drift theory.docx
1. How did society view Alfred Wegener’s continental drift theory.docx
 
1. Having been attacked and bitten by a German shepherd, Sam reacts .docx
1. Having been attacked and bitten by a German shepherd, Sam reacts .docx1. Having been attacked and bitten by a German shepherd, Sam reacts .docx
1. Having been attacked and bitten by a German shepherd, Sam reacts .docx
 
1. How does the current landscape of global HRM impact HR planning .docx
1. How does the current landscape of global HRM impact HR planning .docx1. How does the current landscape of global HRM impact HR planning .docx
1. How does the current landscape of global HRM impact HR planning .docx
 
1. High-level formatting in Windows XP, Vista, and 7 uses which tool.docx
1. High-level formatting in Windows XP, Vista, and 7 uses which tool.docx1. High-level formatting in Windows XP, Vista, and 7 uses which tool.docx
1. High-level formatting in Windows XP, Vista, and 7 uses which tool.docx
 
1. Fully define asymmetrical warfare and discuss the threat.2. D.docx
1. Fully define asymmetrical warfare and discuss the threat.2. D.docx1. Fully define asymmetrical warfare and discuss the threat.2. D.docx
1. Fully define asymmetrical warfare and discuss the threat.2. D.docx
 
1. Four major reasons annual objectives are essential for strategy.docx
1. Four major reasons annual objectives are essential for strategy.docx1. Four major reasons annual objectives are essential for strategy.docx
1. Four major reasons annual objectives are essential for strategy.docx
 

Recently uploaded

Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
PECB
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
heathfieldcps1
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 

Recently uploaded (20)

Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 

Typhoon warning system assignment for one extra credit. Meas

  • 1. 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
  • 2. 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
  • 7. 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
  • 8. 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
  • 9. 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
  • 10. 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
  • 11. 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
  • 12. Yamaguchi 35.6 140.116667 Chiba 35.6 140.116667 Ikata-chō 33.488334 132.354167