Skip to content

Instantly share code, notes, and snippets.

@coderaven
Created December 18, 2012 15:02
Show Gist options
  • Save coderaven/4328756 to your computer and use it in GitHub Desktop.
Save coderaven/4328756 to your computer and use it in GitHub Desktop.
ICTS Programming Competition Solution for Problem A
#include <stdio.h>
#include <string.h>
int main(){
char speeds[100], *splice;
int curr_speed,i;
fgets(speeds,100,stdin);
splice = strtok(speeds," ");
for(i = 1; splice != NULL; i++){
curr_speed = atoi(splice);
printf("Case %d: ",i);
if (curr_speed >= 30 && curr_speed <= 46) printf("Tropical depression\n");
else if (curr_speed >= 47 && curr_speed <= 89) printf("Tropical storm\n");
else if (curr_speed >= 90 && curr_speed <= 183) printf("Typhoon\n");
else if (curr_speed > 183) printf("Super typhoon\n");
else printf("No classification\n");
splice = strtok(NULL," ");
}
getch();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment