error C2059: syntax error : 'type'

来源:百度知道 编辑:UC知道 时间:2024/05/08 17:34:08
#define N 10
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
struct yonghu
{
char name[15];
char pass[6];
}yon[N];
int yon_count=0;
void ma();
void main()
{
FILE*fp;
void zhuche();
int i,j,c,count1,count2,k;
char name[15],pass[6],pass1[6];
count1=0;
count2=0;
do
{
system("cls");
printf("\n\n\t\t 登陆用户请按0,注册用户请按1:");
fflush(stdin);
c=getchar();
switch(c)
{
case 0:
{
system("cls");
printf("\n\n\t\t 登录用户:");
fflush(stdin);
for(i=0;i<15;i++)
{
scanf("%c",&name[i]);
if(name[i]=='\n')
break;
}
printf("\n\t\t

1.while(1)钱的switch没有}结束.
2.void zhuce();在外边定义,从main()移除.C不支持在函数中定义函数吧?最多就是支持递归调用.

int yon_count=0;
void ma();
void zhuche();
然后在后面定义函数体.
void main()
{
}
void zhuche()
{
printf("Register now...");
}

我用GCC测试了一下你的程序不说逻辑与算法的正确性

你的switch语句就没有结束

在}while(1)之前加一个}试一下吧,
还有写程序能不能注意一下代码格式?