主题:急!!!
#include "stdafx.h"
#include <stdio.h>
void main()
{char str[80];
int letter=0,digit=0,space=0,other=0;
gets(str);
printf("input a string:");
printf("??:%d\n??:%d\n??:%d\n??:%d\n",letter,digit,space,other);
}
char str[80]
{[color=800000]char str[80];[/color] [color=FF0000](error C2239: unexpected token '{' following declaration of 'str')[/color]
int i;
for(i=0;str[i]!='\0';i++)
{if(str[i]>='a'&&str[i]<='z'||str[i]>='A'&&str[i]<='Z')
letter++;
else if(str[i]>='0'&str[i]<='9')
digit++;
else if(str[i]=' ')
space++;
else else other++;
return (str[80]);
}
}
#include <stdio.h>
void main()
{char str[80];
int letter=0,digit=0,space=0,other=0;
gets(str);
printf("input a string:");
printf("??:%d\n??:%d\n??:%d\n??:%d\n",letter,digit,space,other);
}
char str[80]
{[color=800000]char str[80];[/color] [color=FF0000](error C2239: unexpected token '{' following declaration of 'str')[/color]
int i;
for(i=0;str[i]!='\0';i++)
{if(str[i]>='a'&&str[i]<='z'||str[i]>='A'&&str[i]<='Z')
letter++;
else if(str[i]>='0'&str[i]<='9')
digit++;
else if(str[i]=' ')
space++;
else else other++;
return (str[80]);
}
}