| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1054 人关注过本帖
标题:请问大神这个程序哪里不对了,dos窗口提示xxx.exe程序已停止工作
只看楼主 加入收藏
aotuyan
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2015-11-3
结帖率:0
收藏
已结贴  问题点数:20 回复次数:4 
请问大神这个程序哪里不对了,dos窗口提示xxx.exe程序已停止工作
#include "stdio.h"
#include "string.h"

#define  M 2
#define  W 2
#define  ns 2
#define  na 2

int main()
{
   
    struct Athlete
    {   
        int item;
        int school;
        int place;
        char name[20];
        int score;  
        char sex;
    };
   
    struct Athlete ath[na];

    for(int i=0;i<na;i++)
    {
        printf("          òÔÏÂêÇμú%d¸öÔ˶ˉÔ±DÅÏ¢μÄêäèë\n",i+1);
        printf("ÇëêäèëÔ˶ˉÔ±DÔ±e±êÖ¾£¨ÄDm/Å®w£©:");
        scanf("%c",&ath[i].sex);
        getchar();rewind(stdin);
        printf("ÇëêäèëÔ˶ˉÔ±2μóÏîÄ¿±àoÅ:");
        scanf("%d",&ath[i].item);
        printf("ÇëêäèëÔ˶ˉÔ±ËùêôѧD£±àoÅ:");
        scanf("%d",&ath[i].school);
        printf("ÇëêäèëÔ˶ˉÔ±ÏîÄ¿ÅÅÃû:");
        scanf("%d",&ath[i].place);
        printf("ÇëêäèëÔ˶ˉÔ±DÕÃû£¨2»¶àóú20¸ö×Ö·û£©:");
        scanf("%s",ath[i].name);
        printf("\n");
        if(ath[i].place==1)
            ath[i].score=5;
        else if(ath[i].place==2)
            ath[i].score=3;
        else if(ath[i].place==3)
            ath[i].score=2;
        else
            ath[i].score=0;
    }
        
    for(int j=1;j<=ns;j++)
    {
        printf("**********************ѧD£±àoÅ%d***************************\n",j);
        printf("        ÏîÄ¿oÅ       Ãû′Π      Ô˶ˉÔ±DÕÃû      μ÷֠ \n");
        for(int i=0;i<na;i++)
        {
            if(ath[i].school==j && ath[i].sex=='m')
            {
                for(int k=1;k<=M;k++)
                {
                    if(ath[i].item==k)
                    printf("     ÄD×ó    %d     %d      %s     %d\n",k,ath[i].place,ath[i].name[20],ath[i].score);
                }
            }

            else if(ath[i].school==j && ath[i].sex=='w')
            {
                for(int k=1;k<=W;k++)
                {   
                    if(ath[i].item==k)
                    printf("     Å®×ó    %d     %d      %s     %d\n",k,ath[i].place,ath[i].name[20],ath[i].score);
                }
            }
        }
    }
return 0;
}
搜索更多相关主题的帖子: include school 
2015-11-03 20:50
aotuyan
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2015-11-3
收藏
得分:0 
#include "stdio.h"
#include "string.h"

#define  M 2
#define  W 2
#define  ns 2
#define  na 2

int main()
{
   
    struct Athlete
    {   
        int item;
        int school;
        int place;
        char name[20];
        int score;  
        char sex;
    };
   
    struct Athlete ath[na];

    for(int i=0;i<na;i++)
    {
        printf("          以下是第%d个运动员信息的输入\n",i+1);
        printf("请输入运动员性别标志(男m/女w):");
        scanf("%c",&ath[i].sex);
        getchar();rewind(stdin);
        printf("请输入运动员参加项目编号:");
        scanf("%d",&ath[i].item);
        printf("请输入运动员所属学校编号:");
        scanf("%d",&ath[i].school);
        printf("请输入运动员项目排名:");
        scanf("%d",&ath[i].place);
        printf("请输入运动员姓名(不多于20个字符):");
        scanf("%s",ath[i].name);
        printf("\n");
        if(ath[i].place==1)
            ath[i].score=5;
        else if(ath[i].place==2)
            ath[i].score=3;
        else if(ath[i].place==3)
            ath[i].score=2;
        else
            ath[i].score=0;
    }
        
    for(int j=1;j<=ns;j++)
    {
        printf("**********************学校编号%d***************************\n",j);
        printf("        项目号       名次       运动员姓名      得分  \n");
        for(int i=0;i<na;i++)
        {
            if(ath[i].school==j && ath[i].sex=='m')
            {
                for(int k=1;k<=M;k++)
                {
                    if(ath[i].item==k)
                    printf("     男子    %d     %d      %s     %d\n",k,ath[i].place,ath[i].name[20],ath[i].score);
                }
            }

            else if(ath[i].school==j && ath[i].sex=='w')
            {
                for(int k=1;k<=W;k++)
                {   
                    if(ath[i].item==k)
                    printf("     女子    %d     %d      %s     %d\n",k,ath[i].place,ath[i].name[20],ath[i].score);
                }
            }
        }
    }
return 0;
}
2015-11-03 20:51
aotuyan
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2015-11-3
收藏
得分:0 
#include "stdio.h"


int main()
{
   
    struct Athlete
    {   
        int item;
        int school;
        int place;
        char name[20];
        int score;  
        char sex;
    };
   
    struct Athlete ath;

   
        printf("ÇëêäèëÔ˶ˉÔ±DÔ±e±êÖ¾£¨ÄDm/Å®w£©:");
        scanf("%c",&ath.sex);
        getchar();rewind(stdin);
        printf("ÇëêäèëÔ˶ˉÔ±2μóÏîÄ¿±àoÅ:");
        scanf("%d",&ath.item);
        printf("ÇëêäèëÔ˶ˉÔ±ËùêôѧD£±àoÅ:");
        scanf("%d",&ath.school);
        printf("ÇëêäèëÔ˶ˉÔ±ÏîÄ¿ÅÅÃû:");
        scanf("%d",&ath.place);
        printf("ÇëêäèëÔ˶ˉÔ±DÕÃû£¨2»¶àóú20¸ö×Ö·û£©:");
        scanf("%s",ath.name);
        printf("\n");
        if(ath.place==1)
            ath.score=5;
        else if(ath.place==2)
            ath.score=3;
        else if(ath.place==3)
            ath.score=2;
        else
            ath.score=0;
    printf("%s",ath.school);
return 0;
}
连这个也是一样的问题
2015-11-03 21:05
aotuyan
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2015-11-3
收藏
得分:0 

 #include "stdio.h"

/*#define  M 2
#define  W 2
#define  ns 2
#define  na 2

int main()
{
    struct Athlete
    {   
        int item;
        int school;
        int place;
        char name[20];
        int score;  
        char sex;
    };
   
    struct Athlete ath;
        printf("请输入运动员性别标志(男m/女w):");
        scanf("%c",&ath.sex);
        getchar();rewind(stdin);
        printf("请输入运动员参加项目编号:");
        scanf("%d",&ath.item);
        printf("请输入运动员所属学校编号:");
        scanf("%d",&ath.school);
        printf("请输入运动员项目排名:");
        scanf("%d",&ath.place);
        printf("请输入运动员姓名(不多于20个字符):");
        scanf("%s",ath.name);
        printf("\n");
        if(ath.place==1)
            ath.score=5;
        else if(ath.place==2)
            ath.score=3;
        else if(ath.place==3)
            ath.score=2;
        else
            ath.score=0;
    printf("%s",ath.school);
return 0;
}
怎么老是乱码
2015-11-03 21:07
pycansi
Rank: 9Rank: 9Rank: 9
等 级:蜘蛛侠
威 望:5
帖 子:418
专家分:1060
注 册:2012-7-26
收藏
得分:20 
回复 4楼 aotuyan
检查 printf


莫问前尘有愧,但求今生无悔
2015-11-04 10:27
快速回复:请问大神这个程序哪里不对了,dos窗口提示xxx.exe程序已停止工作
数据加载中...
 
   



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

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