| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 460 人关注过本帖
标题:忙啦半天不知道如何错啦,求帮忙
只看楼主 加入收藏
何少仪
Rank: 3Rank: 3
等 级:论坛游侠
帖 子:91
专家分:170
注 册:2010-3-6
结帖率:94.44%
收藏
已结贴  问题点数:20 回复次数:3 
忙啦半天不知道如何错啦,求帮忙
#include<stdio.h>        //18:26
#include<stdlib.h>
#include<string.h>
#include<time.h>
#define jj  81
char *answer[jj];
char *question[jj];
int a=1,b,c,num[3];

void input1(); //输入问题
void input2();
int judge();
int judge1(int hh,int ss);
void choice(int num1);


 int main()
{
printf("这是一个类似qq密码的程序。\n");
    input1();
    input2();
printf("请选择第一个问题:(输入1,2,3,4)");
     num[0]=judge1(0,0);
       choice(num[0]);
       num[1]=judge1(num[0],0);
    choice(num[1]);
   if(c==3)
       {
       question=answer=(char*)malloc(3*jj*sizeof(char));
        num[2]=judge1(num[0],num[1]);
        choice(num[2]);
       }
 return 0;
 }     
     
     
     
 void input1()
 {
     
  static char *totalq[jj]={"what the name of mine","who i like the most","when i first do the  1+1,it is"," yourself question"};
            
  
            
  for(int a=1;a<4;a++)
    printf("%d .%s",a,totalq+a-1);
  }
  
  viod input2()
  {
      int b,a;
      printf("你选择几个问题(2个或3个):");
      c=judge();
      for(a=1,b=0;a<=4;a++,b++)
        printf("预设问题:%d个是%s",a,total[b]);
  }
      
int judge()
{    int c;
    while(!scanf("%d",&c)&&(c!=2&&c!=3))
      printf("请输入2或3");
 return c;
}
int judge1(int hh,int ss)           //判断输入1234的正确性
{
  int a;
  static int b=1;
 while(!scanf("%d",&a))
   {
     if(b==1&&(strchr("1234",a)==NULL))
        {printf("请输入数字1,2,3,4::");        
         b++;}
     if(b==2&&(a!=hh&&strchr("1234",a)==NULL))
       {
       printf("请输入数字 :");
       b++;
       }
     if(b==3&&(a!=hh&&a!=ss&&strchr("1234",a)==NULL))
      printf("请输入其他数字");
   }
 return a;     
}
   
void choice(int funny)           //选择答案。
{
    static int a=0;
    printf("%s \n",totalq+funny-1);
      if(funny==4)
       {printf("输入你的问题:");
        gets(question[a]);}
    printf("输入你的答案:");
     gets(answer[a]);
     a++;
}
      
         
   
搜索更多相关主题的帖子: void question include choice 
2010-04-15 16:50
zhuxu0423
Rank: 3Rank: 3
等 级:论坛游侠
帖 子:59
专家分:101
注 册:2010-4-12
收藏
得分:7 
太长了!是不是命名错误啊
2010-04-15 16:52
zhanfffmmm
Rank: 5Rank: 5
等 级:职业侠客
帖 子:238
专家分:343
注 册:2009-10-16
收藏
得分:7 
  viod input2()这个错啦,
2010-04-15 17:22
何少仪
Rank: 3Rank: 3
等 级:论坛游侠
帖 子:91
专家分:170
注 册:2010-3-6
收藏
得分:0 

[b] 你要有勇气去听从你直觉和心灵的指示,所有其他的事情都是次要的。
2010-04-16 14:44
快速回复:忙啦半天不知道如何错啦,求帮忙
数据加载中...
 
   



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

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