#3554: 為什麼是CE?


oiuyjoe (oiuyjoe)


 

下面是我的程式碼,我用C語言來寫的

但他說

"

編譯錯誤, 請檢查語法是否符合系統所支援的編譯器的要求。
錯誤訊息:
/tmp/code_446297.c: In function ‘main’:
/tmp/code_446297.c:14: error: expected expression before ‘/’ token

請教各位智者,我哪裡出錯了?

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

int main()
{
  char a[1000];
  char punc[]=" !@#$%^&*()_+-=[]{};:'<>?"; //分解的地方
	char *p; 
  int x=0;
 while(gets(a)!=NULL)
  {
  
   p=strtok(a,punc);
   while(p!=NULL)
  {
   x++;
   p=strtok(NULL,punc);
 }
  printf("%d\n",x);
  x=0;
 }

return 0;
}

#3555: Re:為什麼是CE?


linishan (L)


 

下面是我的程式碼,我用C語言來寫的

但他說

"

編譯錯誤, 請檢查語法是否符合系統所支援的編譯器的要求。
錯誤訊息:
/tmp/code_446297.c: In function ‘main’:
/tmp/code_446297.c:14: error: expected expression before ‘/’ token

請教各位智者,我哪裡出錯了?

#include
#include

int main()
{
  char a[1000];
  char punc[]=" !@#$%^&*()_+-=[]{};:'<>?"; //分解的地方
	char *p; 
  int x=0;
 while(gets(a)!=NULL)
  {
  
   p=strtok(a,punc);
   while(p!=NULL)
  {
   x++;
   p=strtok(NULL,punc);
 }
  printf("%d\n",x);
  x=0;
 }

return 0;
}


char punc[]=" !@#$%^&*()_+-=[]{};:\'<>?";

應該是這樣吧˙˙   不知道還有沒有其他原因..