| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 8442 人关注过本帖
标题:关于结构体数组作函数参数的问题
取消只看楼主 加入收藏
chen_chuang
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2012-11-9
结帖率:0
收藏
已结贴  问题点数:20 回复次数:0 
关于结构体数组作函数参数的问题
有一段程序:

程序代码:
#include <stdio.h>

struct Students
    {
        int num;
        int score;
    };
    
void print_under_sixty(struct Stduent *stds,int t)
{
    int i,count;
    printf("================\n");
    printf("name    score\n");
    for(i=1;i<=t;i++)
    {
        if(stds.score[i] < 60)
        {
            count++;
            printf("%d%10d\n",stds[i].num,stds[i].score);
        }
    }
    printf("the count of under sixty : %d\n",count);
}

void main()
{
    int total = 0,i;
        Students std[30];
    for(i=1;i<30;i++)
    {
        printf("student %d ",i);
        std[i].num = i;
        scanf("%d",&std[i].score);
        if(std[i].score < 0)
            break;
        total++;
    }
    printf("num    score\n");
    for(i=1;i<=total;i++)
    {
        printf("%d%10d\n",std[i].num,std[i].score);
    }
    print_under_sixty(std,total);
}

print_under_sixty里面好多错误,求大神分析
搜索更多相关主题的帖子: count 结构体 
2012-11-09 19:52
快速回复:关于结构体数组作函数参数的问题
数据加载中...
 
   



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

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