| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 426 人关注过本帖
标题:为什么报“z"没定义?
只看楼主 加入收藏
zxrd1989
Rank: 1
等 级:新手上路
帖 子:53
专家分:0
注 册:2011-5-11
结帖率:64.29%
收藏
已结贴  问题点数:15 回复次数:7 
为什么报“z"没定义?
#include<stdio.h>
#include<stdlib.h>
void main()
{
    {
      int  f(int z);   
    int a,z,b,d;
    printf("" " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " "欢迎使用宿舍管理系统\n");
    printf("" " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " "输入任意键继续!\n");
    printf("" " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " ");
    getchar();//等待键盘输入//
    system("cls");//清屏//

    printf("" " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " "请输入寝室号码,按回车结束!\n");
    printf("" " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " ");
    scanf("%d",&z);//找到切入点,每选择一个数,对应一个子程序,调用子程序//

   
    getchar();
    system("cls");//清屏//
    printf("" " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " "请选择您的操作,按回车结束!\n");
    printf("1*****写入信息****\n");
    printf("2*****查看信息****\n");
    printf("" " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " );//选择输入1还是2??//
    scanf("%d",&b);
     f(b);

}
  int  f(int z);//定义函数//
  {   
      int i=2118;
      if(z==i)
      {
         
          printf("DFSDF");

      }

  }
}
  

   
搜索更多相关主题的帖子: 管理系统 
2011-05-27 17:09
laoyang103
Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19
来 自:内蒙古包头
等 级:贵宾
威 望:19
帖 子:3082
专家分:11056
注 册:2010-5-22
收藏
得分:3 
程序代码:
#include<stdio.h>
#include<stdlib.h>
void main()
{
    int  f(int z);   
    int a,z,b,d;
    printf("" " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " "欢迎使用宿舍管理系统\n");
    printf("" " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " "输入任意键继续!\n");
    printf("" " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " ");
    getchar();//等待键盘输入//
    system("cls");//清屏//

    printf("" " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " "请输入寝室号码,按回车结束!\n");
    printf("" " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " ");
    scanf("%d",&z);//找到切入点,每选择一个数,对应一个子程序,调用子程序//

   
    getchar();
    system("cls");//清屏//
    printf("" " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " "请选择您的操作,按回车结束!\n");
    printf("1*****写入信息****\n");
    printf("2*****查看信息****\n");
    printf("" " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " );//选择输入1还是2??//
    scanf("%d",&b);
    f(b);

}
  int  f(int z)//定义函数//
  {  
      int i=2118;
      if(z==i)
      {
        
          printf("DFSDF");

      }
      return 0;

  }
多家了个分号

                                         
===========深入<----------------->浅出============
2011-05-27 17:11
ansic
Rank: 14Rank: 14Rank: 14Rank: 14
来 自:恍惚窈冥
等 级:城市猎人
帖 子:1543
专家分:5367
注 册:2011-2-15
收藏
得分:3 
int  f(int z);//定义函数// 《----这里不许用分号

善人者,不善人之师;不善人者,善人之资。不贵其师,不爱其资,虽智大迷。
2011-05-27 17:13
zxrd1989
Rank: 1
等 级:新手上路
帖 子:53
专家分:0
注 册:2011-5-11
收藏
得分:0 
#include<stdio.h>
#include<stdlib.h>
void main()
{
    {
      int  f(int z);   
    int a,z,b,d;
    printf("" " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " "欢迎使用宿舍管理系统\n");
    printf("" " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " "输入任意键继续!\n");
    printf("" " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " ");
    getchar();//等待键盘输入//
    system("cls");//清屏//

    printf("" " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " "请输入寝室号码,按回车结束!\n");
    printf("" " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " ");
    scanf("%d",&z);//找到切入点,每选择一个数,对应一个子程序,调用子程序//

   
    getchar();
    system("cls");//清屏//
    printf("" " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " "请选择您的操作,按回车结束!\n");
    printf("1*****写入信息****\n");
    printf("2*****查看信息****\n");
    printf("" " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " );//选择输入1还是2??//
    scanf("%d",&b);
    d=f(b);
    printf("%d",d);

}
  int  f(int z)//定义函数//
  {   
      int i=2118;
      if(z==i)
      {
         
          printf("%d",z);

      }

  }
}
  
error C2601: 'f' : local function definitions are illegal??还是有问题
   
2011-05-27 17:23
laoyang103
Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19
来 自:内蒙古包头
等 级:贵宾
威 望:19
帖 子:3082
专家分:11056
注 册:2010-5-22
收藏
得分:0 
你把我发的代码粘过去

                                         
===========深入<----------------->浅出============
2011-05-27 17:37
烟雾中的迷茫
Rank: 9Rank: 9Rank: 9
等 级:蜘蛛侠
帖 子:621
专家分:1069
注 册:2011-2-9
收藏
得分:3 
int  f(int z);//定义函数//
也就是说此处 又申明了 函数而不是定义 所以你后面用的时候当然没定义了 去掉;分号
2011-05-27 22:04
coolsonic
Rank: 1
等 级:新手上路
帖 子:3
专家分:5
注 册:2011-5-28
收藏
得分:3 
你干嘛要这样定义函数呢,全都揉在一起,非常不好的习惯,你还是先找本编程规范看看吧
2011-05-28 09:00
darklv10
Rank: 1
等 级:新手上路
帖 子:5
专家分:7
注 册:2007-4-27
收藏
得分:3 
z定义了两次...
2011-05-28 12:15
快速回复:为什么报“z"没定义?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.048054 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved