标题:帮忙纠正错误了,兄弟们!
只看楼主
lytlytlytlyt
Rank: 1
来 自:河南郑州
等 级:新手上路
帖 子:10
专家分:0
注 册:2011-4-30
结帖率:0
已结贴  问题点数:20 回复次数:4 
帮忙纠正错误了,兄弟们!
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#define N 10                         /*扩展宏定义*/

int random(int);                     /*随机变量函数*/
void duanyu();                       //函数声明
void juzi();

void main()                          //函数定义
{
    char str[5];                    //变量说明
   
    printf("xian zai xue xi kai shi ,qing xiao peng you zuo hao zhunbei!\n");
    printf("zhun bei hao le ma ?\n");
    printf("yes ? no ?\n");
    gets(str);
    if(strcmp(str,"yes")==0)
    {
        void danci();
    }
    else
    {
        exit(1);
    }
}

void danci()
{
//变量说明
    int i;
    int jinji;
    int count=0;
    char wenti[N][10];
    char daan[N][10];
    long wentiweizhi;
    char shuru[10];
   
                                       //变量定义,函数输入部分
    wenti[N][10]={"banana","apple","follow","come","go","here","there","he","she","look"};
    daan[N][10]={"香蕉","苹果","跟随","来","去","这里","那里","他","她","看"};
   
    for(i=0;i<10;i++)                //测试部分
    {
        wentiweizhi=random(N+1);     //随机数发生器随机取数
        printf("%50c",wenti[wentiweizhi]);
        printf("qing ba ying wen dan ci fan yi cheng han yu\n");
        
        gets(shuru);
        
        if(strcmp(daan[wentiweizhi],shuru)==0)
        {
            printf("ni tai bang le,ji xu jia you!\n");
            count ++;
        }
        else
            printf("da an cuo wu ,ji xu jia you o!");
        
    }
   
    jinji=count%7;//10道题回答正确8道题,才能晋级
   
    if(jinji>0)
    {
        goto void duanyu();
    }
    else
    {
        printf("xiao peng you ni dan ci bu guo guan ,hai yao ji xu bei dan ci");
    }
}

void duanyu()
{
   
    int i;
    int jinji;
    int count=0;
    char wenti[N][30];
    char daan[N][30];
    long wentiweizhi;
    char shuru[30];
   
    wenti[N][30]={"look at ","add to ","admit into ","all but",
        "at rest","aware of","come on","come acorss","laugh at","look after"};
    daan[N][30]={"看一看","增加","允许入内","几乎","静止不动",
        "意识到","加油","遇见","嘲笑","照顾"};
   
    for(i=0;i<10;i++)
    {
        wentiweizhi=random(N+1);
        printf("%50c",wenti[wentiweizhi]);
        printf("qing  ba han yu duan yu ci fan yi cheng ying yu\n");
        
        gets(shuru);
        
        if(strcmp(daan[wentiweizhi],shuru)==0)
        {
            printf("ni tai bang le,ji xu jia you!\n");
            count ++;
        }
        else
            printf("da an cuo wu ,ji xu jia you o!");
        
    }
   
    jinji=count%7;//10道题回答正确8道题,才能晋级
   
    if(jinji>0)
    {
        printf("ni tai bang le,ji xu jia you! xia yi guan shi duan yu xue xi\n");
        duanyu();
    }
    else
    {
        printf("xiao peng you ni de duan yu bu guo guan ,chong xin cong can ci\n");
        goto void danci;
    }
}

void juzi()
{
   
    int i,j;
    int jinji;
    int count=0;
    char wenti[N][50];
    char daan[N][50];
    long wentiweizhi;
    char shuru[50];
   
    wenti[N][50]={"I am a boy.","She is a girl"," See you later!","Thank you!",
        "How are you?","Me  too!","Welcome to ping ding shan",
        "Nice to meet you !","let us go!","What are you doing?"};
    daan[N][50]={"我是一个男孩","她是一个女孩","再见","谢谢你","你好吗",
        "我也是","欢迎来到平顶山",
        "很高兴见到你","我们走","你在干什么"};
   
    for(i=0;i<10;i++)
    {
        wentiweizhi=random(N+1);
        printf("%50c",wenti[wentiweizhi]);
        printf("qing  gen ju ying wen ti shi xie chu xiang ying de hui da");
        
        gets(shuru);
        
        if(strcmp(daan[wentiweizhi],shuru)==0)
        {
            printf("ni tai bang le,ji xu jia you!\n");
            count ++;
        }
        else
            printf("da an cuo wu ,ji xu jia you o!");
        
    }
   
    jinji=count%7;//10道题回答正确8道题,才能晋级
   
    if(jinji>0)
    {
        printf("congratulations!!!!!!\n");
    }
    else
    {
        printf("xiao peng you ni de duan yu bu guo guan ,chong xin cong can ci");
        goto  void duanyu;
    }
}



调试结果:

--------------------Configuration: 小学英语教学系统 - Win32 Debug--------------------
Compiling...
小学英语教学.c
D:\标准c\小学英语教学系统\小学英语教学.c(19) : warning C4013: 'strcmp' undefined; assuming extern returning int
D:\标准c\小学英语教学系统\小学英语教学.c(41) : error C2059: syntax error : '{'
D:\标准c\小学英语教学系统\小学英语教学.c(42) : error C2059: syntax error : '{'
D:\标准c\小学英语教学系统\小学英语教学.c(66) : error C2059: syntax error : 'type'
D:\标准c\小学英语教学系统\小学英语教学.c(85) : error C2059: syntax error : '{'
D:\标准c\小学英语教学系统\小学英语教学.c(87) : error C2059: syntax error : '{'
D:\标准c\小学英语教学系统\小学英语教学.c(118) : error C2059: syntax error : 'type'
D:\标准c\小学英语教学系统\小学英语教学.c(133) : error C2059: syntax error : '{'
D:\标准c\小学英语教学系统\小学英语教学.c(136) : error C2059: syntax error : '{'
D:\标准c\小学英语教学系统\小学英语教学.c(167) : error C2059: syntax error : 'type'
执行 cl.exe 时出错.

小学英语教学.obj - 1 error(s), 0 warning(s)
搜索更多相关主题的帖子: xian 兄弟 xiao qing 
2011-06-15 09:18
voidx
Rank: 12Rank: 12Rank: 12
来 自:邯郸
等 级:火箭侠
帖 子:1250
专家分:3538
注 册:2011-4-7
得分:10 
楼主以前是不是学过汇编或者 basic ?
去重新认真的看看书吧。搞清楚在 c 语言里调用函数

[ 本帖最后由 voidx 于 2011-6-15 09:29 编辑 ]
2011-06-15 09:28
laoyang103
Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19
来 自:内蒙古包头
等 级:贵宾
威 望:19
帖 子:3082
专家分:11056
注 册:2010-5-22
得分:10 
程序代码:
#include<stdio.h>
#include<stdlib.h>
#include <string.h>
#include<time.h>
#define N 10                         /*扩展宏定义*/

void duanyu();                       //函数声明
void juzi();
void danci()
{
//变量说明
    int i;
    int jinji;
    int count=0;
    char wenti[N][10]={"banana","apple","follow","come","go","here","there","he","she","look"};;
    char daan[N][10]={"香蕉","苹果","跟随","","","这里","那里","","",""};;
    long wentiweizhi;
    char shuru[10];
   
                                       //变量定义,函数输入部分
   
    for(i=0;i<10;i++)                //测试部分
    {
        wentiweizhi=rand()%(N+1);   //随机数发生器随机取数
        printf("%50c",wenti[wentiweizhi]);
        printf("qing ba ying wen dan ci fan yi cheng han yu\n");
       
        gets(shuru);
       
        if(strcmp(daan[wentiweizhi],shuru)==0)
        {
            printf("ni tai bang le,ji xu jia you!\n");
            count ++;
        }
        else
            printf("da an cuo wu ,ji xu jia you o!");
       
    }
   
    jinji=count%7;//10道题回答正确8道题,才能晋级
   
    if(jinji>0)
    {
        duanyu();
    }
    else
    {
        printf("xiao peng you ni dan ci bu guo guan ,hai yao ji xu bei dan ci");
    }
}

void main()                          //函数定义
{
    char str[5];                    //变量说明
   
    printf("xian zai xue xi kai shi ,qing xiao peng you zuo hao zhunbei!\n");
    printf("zhun bei hao le ma ?\n");
    printf("yes ? no ?\n");
    gets(str);
    int a = strcmp(str,"yes");
    if(0 == a)
    {
        danci();
    }
    else
    {
        exit(1);
    }
}


void duanyu()
{
   
    int i;
    int jinji;
    int count=0;
    char wenti[N][30]={"look at ","add to ","admit into ","all but",
        "at rest","aware of","come on","come acorss","laugh at","look after"};;
    char daan[N][30]={"看一看","增加","允许入内","几乎","静止不动",
        "意识到","加油","遇见","嘲笑","照顾"};;
    long wentiweizhi;
    char shuru[30];
   
   
    for(i=0;i<10;i++)
    {
        wentiweizhi=rand()%(N+1);
        printf("%50c",wenti[wentiweizhi]);
        printf("qing  ba han yu duan yu ci fan yi cheng ying yu\n");
       
        gets(shuru);
       
        if(strcmp(daan[wentiweizhi],shuru)==0)
        {
            printf("ni tai bang le,ji xu jia you!\n");
            count ++;
        }
        else
            printf("da an cuo wu ,ji xu jia you o!");
       
    }
   
    jinji=count%7;//10道题回答正确8道题,才能晋级
   
    if(jinji>0)
    {
        printf("ni tai bang le,ji xu jia you! xia yi guan shi duan yu xue xi\n");
        duanyu();
    }
    else
    {
        printf("xiao peng you ni de duan yu bu guo guan ,chong xin cong can ci\n");
        danci();
    }
}

void juzi()
{
   
    int i,j;
    int jinji;
    int count=0;
    char wenti[N][50]={"I am a boy.","She is a girl"," See you later!","Thank you!",
        "How are you?","Me  too!","Welcome to ping ding shan",
        "Nice to meet you !","let us go!","What are you doing?"};;
    char daan[N][50]={"我是一个男孩","她是一个女孩","再见","谢谢你","你好吗",
        "我也是","欢迎来到平顶山",
        "很高兴见到你","我们走","你在干什么"};;
    long wentiweizhi;
    char shuru[50];
   
    for(i=0;i<10;i++)
    {
        wentiweizhi=rand()%(N+1);
        printf("%50c",wenti[wentiweizhi]);
        printf("qing  gen ju ying wen ti shi xie chu xiang ying de hui da");
       
        gets(shuru);
       
        if(strcmp(daan[wentiweizhi],shuru)==0)
        {
            printf("ni tai bang le,ji xu jia you!\n");
            count ++;
        }
        else
            printf("da an cuo wu ,ji xu jia you o!");
       
    }
   
    jinji=count%7;//10道题回答正确8道题,才能晋级
   
    if(jinji>0)
    {
        printf("congratulations!!!!!!\n");
    }
    else
    {
        printf("xiao peng you ni de duan yu bu guo guan ,chong xin cong can ci");
        duanyu();
    }
}
编译错误没了  代码太纠结了 全市拼音写的

                                         
===========深入<----------------->浅出============
2011-06-15 09:32
lytlytlytlyt
Rank: 1
来 自:河南郑州
等 级:新手上路
帖 子:10
专家分:0
注 册:2011-4-30
得分:0 
呵呵,因为是给小学生写的软件嘛。。。。呵呵
2011-09-06 08:37
lytlytlytlyt
Rank: 1
来 自:河南郑州
等 级:新手上路
帖 子:10
专家分:0
注 册:2011-4-30
得分:0 
现在已经写好了,但是不会用rand()函数。。。。。谁能帮我举个例子,,发表前请大侠运行一下哈
2011-09-17 21:54



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-342902-1-1.html




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

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