#include<stdio.h> #include<stdlib.h> #include<string> int main() { int a = 0, b = 0, c = 0, d = 0, e = 0; int k=1, n,sum; char B[10000]; while (scanf("%d",&n)!=EOF) { while (n--) { scanf("%s", B); if (strcmp(B, "Pleasant") == 0) { a++; } else if (strcmp(B, "Pretty") == 0) { b++; } else if (strcmp(B, "Athletic") == 0) { c++; } else if (strcmp(B, "Lazy") == 0) { d++; } else if (strcmp(B, "Slow") == 0) { e++; } } sum = a * 5 + b * 8 + c * 10 + d * 15 + e * 20; if ((a + b + c + d + e) >= 12 && c > 0) { sum += 50; } printf("Case #%d: %d\n", k, sum); k++; } return 0; } /* Main.cc: In function 'int main()': Main.cc:14:8: error: 'strcmp' was not declared in this scope if (strcmp(B, "Pleasant") == 0) ^~~~~~ Main.cc:14:8: note: 'strcmp' is defined in header '<cstring>'; did you forget to '#include <cstring>'? Main.cc:4:1: +#include <cstring> int main() Main.cc:14:8: if (strcmp(B, "Pleasant") == 0) ^~~~~~ */ |
Double click to view unformatted code.