Language: C++

Skip to content
This repository
Search
Pull requests
Issues
Gist
 @aibaakihito1994
You don???t have any verified emails. We recommend verifying at least one email.
Email verification helps our support team verify ownership if you lose account access and allows you to receive all the notifications you ask for.
 Watch 1
  Star 0
  Fork 0 wada811/AOJ
 Code  Issues 0  Pull requests 0  Wiki  Pulse  Graphs
Branch: master Find file Copy pathAOJ/vol100/AOJ10032.cpp
98e1903  on 6 Feb 2012
 wada811 add
0 contributors
RawBlameHistory     57 lines (51 sloc)  1.1 KB
// AIZU ONLINE JUDGE http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=10032
//*
#include <stdio.h>
#include <string.h>
#define MAX 1000

void push(char stack[MAX], char c){
    int i;
    for(i=MAX;i>0;i--){
        stack[i]=stack[i-1];
    }
    stack[0]=c;
}

char pop(char stack[MAX]){
    int i;
    char c;
    c=stack[0];
    for(i=1;i<MAX;i++){
        stack[i-1]=stack[i];
    }
    return c;
}

void show(int n, char array[MAX]){
    int i;
    for(i=0;i<n;i++){
        printf("%c\n", array[i]);
    }
}

int main(){
    int n, m;
    char cmnd[5], stack[MAX], pops[MAX];
    char c;
    int i=0, j=0;
    
    scanf("%d", &n);
    while(1){
        scanf("%s", cmnd);
        if(strcmp(cmnd, "quit")==0){
            break;
        }else if(strcmp(cmnd, "pop")==0){
            pops[j++]=pop(stack);
        }else if(strcmp(cmnd, "push")==0){
            scanf(" %c", &c);
            push(stack, c);
        }else if(strcmp(cmnd, "show")==0){
            // ??f??o??b??O???p
            show(MAX, stack);
        }
    }
    show(j, pops);

    return 0;
}
//*/
Status API Training Shop Blog About
?? 2016 GitHub, Inc. Terms Privacy Security Contact Help

Compiler output:
a.cc:7:2: error: stray '@' in program
    7 |  @aibaakihito1994
      |  ^
a.cc:15:1: warning: floating constant exceeds range of 'double' [-Woverflow]
   15 | 98e1903  on 6 Feb 2012
      | ^~~~~~~
a.cc:1:1: error: 'Skip' does not name a type
    1 | Skip to content
      | ^~~~
In file included from a.cc:22:
/usr/include/string.h:44:22: error: 'size_t' has not been declared
   44 |                      size_t __n) __THROW __nonnull ((1, 2));
      |                      ^~~~~~
/usr/include/string.h:47:56: error: 'size_t' has not been declared
   47 | extern void *memmove (void *__dest, const void *__src, size_t __n)
      |                                                        ^~~~~~
/usr/include/string.h:55:32: error: 'size_t' has not been declared
   55 |                       int __c, size_t __n)
      |                                ^~~~~~
/usr/include/string.h:61:42: error: 'size_t' has not been declared
   61 | extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
      |                                          ^~~~~~
/usr/include/string.h:64:56: error: 'size_t' has not been declared
   64 | extern int memcmp (const void *__s1, const void *__s2, size_t __n)
      |                                                        ^~~~~~
/usr/include/string.h:80:60: error: 'size_t' has not been declared
   80 | extern int __memcmpeq (const void *__s1, const void *__s2, size_t __n)
      |                                                            ^~~~~~
/usr/include/string.h:87:42: error: 'size_t' has not been declared
   87 | extern void *memchr (void *__s, int __c, size_t __n)
      |                                          ^~~~~~
/usr/include/string.h:89:54: error: 'size_t' has not been declared
   89 | extern const void *memchr (const void *__s, int __c, size_t __n)
      |                                                      ^~~~~~
/usr/include/string.h:126:49: error: 'size_t' has not been declared
  126 | extern "C++" void *memrchr (void *__s, int __c, size_t __n)
      |                                                 ^~~~~~
/usr/include/string.h:129:61: error: 'size_t' has not been declared
  129 | extern "C++" const void *memrchr (const void *__s, int __c, size_t __n)
      |                                                             ^~~~~~
/usr/include/string.h:145:53: error: 'size_t' has not been declared
  145 |                       const char *__restrict __src, size_t __n)
      |                                                     ^~~~~~
/usr/include/string.h:153:23: error: 'size_t' has not been declared
  153 |                       size_t __n) __THROW __nonnull ((1, 2));
      |                       ^~~~~~
/usr/include/string.h:159:57: error: 'size_t' has not been declared
  159 | extern int strncmp (const char *__s1, const char *__s2, size_t __n)
      |                                                         ^~~~~~
/usr/include/string.h:166:8: error: 'size_t' does not name a type
  166 | extern size_t strxfrm (char *__restrict __dest,
      |        ^~~~~~
/usr/include/string.h:34:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
   33 | #include <stddef.h>
  +++ |+#include <cstddef>
   34 | 
/usr/include/string.h:179:8: error: 'size_t' does not name a type
  179 | extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n,
      |        ^~~~~~
/usr/include/string.h:179:8: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/string.h:195:45: error: 'size_t' has not been declared
  195 | extern char *strndup (const char *__string, size_t __n)
      |                                             ^~~~~~
/usr/include/string.h:293:8: error: 'size_t' does not name a type
  293 | extern size_t strcspn (const char *__s, const char *__reject)
      |        ^~~~~~
/usr/include/string.h:293:8: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/string.h:297:8: error: 'size_t' does not name a type
  297 | extern size_t strspn (const char *__s, const char *__accept)
      |        ^~~~~~
/usr/include/string.h:297:8: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/string.h:389:46: error: 'size_t' has not been declared
  389 | extern void *memmem (const void *__haystack, size_t __haystacklen,
      |                                              ^~~~~~
/usr/include/string.h:390:44: error: 'size_t' has not been declared
  390 |                      const void *__needle, size_t __needlelen)
      |                                            ^~~~~~
/usr/include/string.h:398:55: error: 'size_t' has not been declared
  398 |                         const void *__restrict __src, size_t __n)
      |                                                       ^~~~~~
/usr/include/string.h:401:53: error: 'size_t' has not been declared
  401 |                       const void *__restrict __src, size_t __n)
      |                                                     ^~~~~~
/usr/include/string.h:407:8: error: 'size_t' does not name a type
  407 | extern size_t strlen (const char *__s)
      |        ^~~~~~
/usr/include/string.h:407:8: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/string.h:413:8: error: 'size_t' does not name a type
  413 | extern size_t strnlen (const char *__string, size_t __maxlen)
      |        ^~~~~~
/usr/include/string.h:413:8: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/string.h:444:53: error: 'size_t' has not been declared
  444 | extern char *strerror_r (int __errnum, char *__buf, size_t __buflen)
      |                                                     ^~~~~~
In file included from /usr/include/string.h:462:
/usr/include/strings.h:34:54: error: 'size_t' has not been declared
   34 | extern int bcmp (const void *__s1, const void *__s2, size_t __n)
      |                                                      ^~~~~~
/usr/include/strings.h:38:53: error: 'size_t' has not been declared
   38 | extern void bcopy (const void *__src, void *__dest, size_t __n)
      |                                                     ^~~~~~
/usr/include/strings.h:42:31: error: 'size_t' has not been declared
   42 | extern void bzero (void *__s, size_t __n) __THROW __nonnull ((1));
      |                               ^~~~~~
/usr/include/strings.h:120:61: error: 'size_t' has not been declared
  120 | extern int strncasecmp (const char *__s1, const char *__s2, size_t __n)
      |                                                             ^~~~~~
/usr/include/strings.h:134:27: error: 'size_t' has not been declared
  134 |                           size_t __n, locale_t __loc)
      |                           ^~~~~~
/usr/include/string.h:466:40: error: 'size_t' has not been declared
  466 | extern void explicit_bzero (void *__s, size_t __n) __THROW __nonnull ((1))
      |                                        ^~~~~~
/usr/include/string.h:497:55: error: 'size_t' has not been declared
  497 |                         const char *__restrict __src, size_t __n)
      |                                                       ^~~~~~
/usr/include/string.h:500:53: error: 'size_t' has not been declared
  500 |                       const char *__restrict __src, size_t __n)
      |                                                     ^~~~~~
/usr/include/string.h:506:8: error: 'size_t' does not name a type
  506 | extern size_t strlcpy (char *__restrict __dest,
      |        ^~~~~~
/usr/include/string.h:506:8: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/string.h:512:8: error: 'size_t' does not name a type
  512 | extern size_t strlcat (char *__restrict __dest,
      |        ^~~~~~
/usr/include/string.h:512:8: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/string.h:526:34: error: 'size_t' has not been declared
  526 | extern void *memfrob (void *__s, size_t __n) __THROW __nonnull ((1))
      |                                  ^~~~~~
a.cc: In function 'void show(int, char*)':
a.cc:46:9: error: 'printf' was not declared in this scope
   46 |         printf("%c\n", array[i]);
      |         ^~~~~~
a.cc:23:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
   22 | #include <string.h>
  +++ |+#include <cstdio>
   23 | #define MAX 1000
a.cc: In function 'int main()':
a.cc:56:5: error: 'scanf' was not declared in this scope
   56 |     scanf("%d", &n);
      |     ^~~~~
a.cc: At global scope:
a.cc:76:1: error: 'Status' does not name a type
   76 | Status API Training Shop Blog About
      | ^~~~~~