View Code of Problem 9

nclude <stdio.h>
#include <string.h>
#include <math.h>

int main()
{
    int n,i=1;
    
    while(scanf("%d",&n)!=EOF){
        int sum=0,flag=0;
        char str[10000],g[10000];
            
        for(int j=0;j<n;j++)
        {
            scanf("%s %s",str,g);

            if(strcmp(str,"Pleasant")==0)
                sum+=5;
            else if(strcmp(str,"Pretty")==0)
                sum+=8;
            else if(strcmp(str,"Athletic")==0){
                sum+=10;
                flag=1;
            }
            else if(strcmp(str,"Lazy")==0)
                sum+=15;
            else if(strcmp(str,"Slow")==0)
                sum+=20;

        }
        if(n>=10&&flag==1)
            sum+=50;

        printf("Case #%d:%d\n",i++,sum);
    }

    return 0;
}
/*
Main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
 nclude <stdio.h>
        ^
In file included from Main.c:2:0:
/usr/include/string.h:47:8: error: unknown type name 'size_t'
        size_t __n) __THROW __nonnull ((1, 2));
        ^
/usr/include/string.h:50:56: error: unknown type name 'size_t'
 extern void *memmove (void *__dest, const void *__src, size_t __n)
                                                        ^
/usr/include/string.h:66:42: error: unknown type name 'size_t'
 extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
                                          ^
/usr/include/string.h:69:56: error: unknown type name 'size_t'
 extern int memcmp (const void *__s1, const void *__s2, size_t __n)
                                                        ^
/usr/include/string.h:96:48: error: unknown type name 'size_t'
 extern void *memchr (const void *__s, int __c, size_t __n)
                                                ^
/usr/include/string.h:133:39: error: unknown type name 'size_t'
         const char *__restrict __src, size_t __n)
                                       ^
/usr/include/string.h:141:9: error: unknown type name 'size_t'
         size_t __n) __THROW __nonnull ((1, 2));
         ^
/usr/include/string.h:147:57: error: unknown type name 'size_t'
 extern int strncmp (const char *__s1, const char *__s2, size_t __n)
                                                         ^
/usr/include/string.h:154:8: error: unknown type name 'size_t'
 extern size_t strxfrm (char *__restrict __dest,
        ^
/usr/include/string.h:155:40: error: unknown type name 'size_t'
          const char *__restrict __src, size_t __n)
                                        ^
/usr/include/string.h:285:8: error: unknown type name 'size_t'
 extern size_t strcspn (const char *__s, const char *__reject)
        ^
/usr/include/string.h:289:8: error: unknown type name 'size_t'
 extern size_t strspn (const char *__s, const char *__accept)
        ^
/usr/include/string.h:399:8: error: unknown type name 'size_t'
 extern size_t strlen (const char *__s)
        ^
/usr/include/string.h:451:33: error: unknown type name 'size_t'
 extern void __bzero (void *__s, size_t __n) __THROW __nonnull ((1));
                                 ^
Main.c: In function 'main':
Main.c:9:5: warning: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
     while(scanf("%d",&n)!=EOF){
     ^
Main.c:9:11: warning: incompatible implicit declaration of built-in function 'scanf'
     while(scanf("%d",&n)!=EOF){
           ^
Main.c:9:27: error: 'EOF' undeclared (first use in this function)
     while(scanf("%d",&n)!=EOF){
                           ^
Main.c:9:27: note: each undeclared identifier is reported only once for each function it appears in
Main.c:34:9: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
         printf("Case #%d:%d\n",i++,sum);
         ^
Main.c:34:9: warning: incompatible implicit declaration of built-in function 'printf'
*/

Double click to view unformatted code.


Back to problem 9