| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 493 人关注过本帖
标题:一个数据处理软件
只看楼主 加入收藏
hlmzrdongdong
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:湖北武汉
等 级:版主
威 望:1
帖 子:99
专家分:145
注 册:2008-10-24
结帖率:100%
收藏
 问题点数:0 回复次数:2 
一个数据处理软件
本软件包含数据模型建立、平均值计算、偶然误差和残余误差计算、单词测量和算术平均值标准差计算
下面是用户界面:
target="_blank"><img src="http://i. border="0"></a>" border="0" />

代码如下:

#include<stdio.h>
#include<math.h>
#include<conio.h>
#define N 100
#define M 3



void instruction(void)
{
    window(5,5,75,21);
    textbackground(BLUE);
    clrscr();
    textcolor(WHITE);
    
    printf("                   ********* INSTRUCTIONS *********\n");
    printf("      -------------------------------------------------------------------\n");
    printf("      ->Edtion:V0.0.2\n");
    printf("      ->Author:XiangDong you \n");
    printf("      ->E-mail:hlmzrdongdong@\n");
    printf("      ->Attention:only run on TC2.0,cann't run on VC++\n");
    printf("      -------------------------------------------------------------------\n\n");
    printf("                      >>>>>>>>>>>>> MAIN MENU <<<<<<<<<<<\n");
    printf("      -------------------------------------------------------------------\n");
    printf("      1->Build the datas model\n");
    printf("      2->Calculate the averagevalue\n");
    printf("      3->Calculate the errorvalue\n");
    printf("      4->Calculate the per_standard or averagevaluestandard errorvalue \n");
    printf("      -------------------------------------------------------------------\n");
    printf("\n                         Press any key to contiune!");
      
}


struct data
{
    float value[N];
    float errorvalue[N];
    float averagevalue;
    float standardvalue;
    float per_standardvalue;
};

struct data1
{
    float value[N];
    float errorvalue[N];
    float averagevalue;
    float standardvalue;
    float per_standardvalue;
};
 
int build_Data(struct data *pp)
{
    int realN;
    int i;
    
    
    window(5,5,75,21);
    textbackground(BLUE);
    clrscr();
    textcolor(WHITE);
    
    cprintf("1->Build the datas model\n");
    cprintf("\r ->Please input the total number of the datas:");
    scanf("%d",&realN);
    cprintf("\r ->The total number is:%d\n",realN);
    cprintf("\r ->Please input the datas ,seclude by space,ends by Enter:\n\r");
    for(i=0;i<realN;i++)
    {
        cscanf("%f",&pp->value[i]);
    }
    cprintf("\n\r ->The following is the datas:\n\r");
    for(i=0;i<realN;i++)
    {
        cprintf(" x[%d]=%10.5f   ",i,pp->value[i]);
        if((i+1)%3==0)cprintf("\n\r");
    }
    return realN;    
 }


void Count_averagevalue(struct data *pp,int realN)
{
    int i;
    window(5,5,75,21);
    textbackground(BLUE);
    clrscr();
    textcolor(WHITE);
    cprintf("2->Calculate the averagevalue\n");
    pp->averagevalue=0.0;
    for(i=0;i<realN;i++)
        pp->averagevalue=pp->averagevalue+pp->value[i];
    pp->averagevalue=pp->averagevalue/((float)realN);
    cprintf("\r ->The averagevalue is:%10.5f\n",pp->averagevalue);
    cprintf("\n\r   Press any key to contiune!");
}


void Count_standardvalue(struct data *pp,int realN)
{
    int i;
    int j;
    
    window(5,5,75,21);
    textbackground(BLUE);
    clrscr();
    textcolor(WHITE);
    
    cprintf("4->Calculate the per_standard or averagevalue standard errorvalue\n");
    cprintf("\r ->Please choose the formulary:\n");
    cprintf("\r       1->Bessel formulary  2->Peters formulary\n");
    cprintf("\r  Please input the number to choose:");
    scanf("%d",&j);
    pp->averagevalue=0.0;
    for(i=0;i<realN;i++)
    {
        pp->standardvalue=pp->standardvalue+pp->errorvalue[i]*pp->errorvalue[i];

    }
    if(j==1)
    {
        pp->per_standardvalue=sqrt(pp->standardvalue/((float)(realN-1)));
        pp->standardvalue=pp->per_standardvalue/sqrt((float) realN);
        cprintf("\r ->The per_standard errorvalue is:%f\n",pp->per_standardvalue);
        cprintf("\r ->The averagevalue standard errorvalue is:%f\n",pp->standardvalue);
    }
    else if(j==2)
    {
        pp->per_standardvalue=1.253*pp->standardvalue/sqrt((float)(realN*(realN-1)));
        pp->standardvalue=1.253*pp->standardvalue/(((float)realN)*sqrt((float)(realN-1)));
        cprintf("\n\r ->The per_standard errorvalue is :%f\n",pp->per_standardvalue);
        cprintf("\r ->The averagevalue standard errorvalue:%f\n\r",pp->standardvalue);
    }
}


void Count_errorvalue(struct data *pp,int realN)
{
    int i;
    float realvalue;
    window(5,5,75,21);
    textbackground(BLUE);
    clrscr();
    textcolor(WHITE);
    cprintf("3->Calculate the errorvalue\n");
    cprintf("\r ->Input the realvalue or input 0 to calculate by averagevalue:");
    scanf("%f",&realvalue);
    if(realvalue==0)
        realvalue=pp->averagevalue;
    for(i=0;i<realN;i++)
        pp->errorvalue[i]=pp->value[i]-realvalue;
    cprintf("\n\r ->The datas' errorvalue is :\n\r");
    for(i=0;i<realN;i++)
    {
        cprintf(" v[%d]=%10.5f   ",i,pp->errorvalue[i]);
        if((i+1)%3==0)cprintf("\n\r");
    }
   cprintf("\n\r Press any key to contiune!");
}



void main(void)
{
    struct data datas;
    struct data *p;
    int realN;
    p=&datas;
    textmode(C80);
    textbackground(BLACK);
    clrscr();
    textcolor(WHITE);
    cprintf("                         $--------------------------$");  
    cprintf("\n\r                         $--  DATA MANAGE SYSTEM  --$");  
    cprintf("\n\r                         $--------------------------$");
    cprintf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
    cprintf("\r                        China University of Geosciences\n");
    cprintf("\r                Copyright @ XiangDong you 062062-21 Oct.27th 2008");  
    window(2,4,78,22);
    textbackground(GREEN);
    clrscr();
    
    instruction();    
    getch();
    realN=build_Data(p);
    cprintf("\n\n\r   Press any key to contiune!");
    getch();
    getch();
    Count_averagevalue(p,realN);
    getch();
    Count_errorvalue(p,realN);
    getch();
    Count_standardvalue(p,realN);
}
搜索更多相关主题的帖子: 数据处理 软件 
2008-10-28 11:07
wanjiang
Rank: 1
等 级:新手上路
帖 子:85
专家分:0
注 册:2008-10-25
收藏
得分:0 
感觉挺奇怪的,怎么在tc2.0里面可以编辑,到了vc中就不出现错误了呢
2008-10-28 16:30
hlmzrdongdong
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:湖北武汉
等 级:版主
威 望:1
帖 子:99
专家分:145
注 册:2008-10-24
收藏
得分:0 
回复 2# 的帖子
因为里面有些库函数在VC里面没有。主要是些对DOS屏幕的操作和画图的函数。
2008-10-28 17:38
快速回复:一个数据处理软件
数据加载中...
 
   



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

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