| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 4362 人关注过本帖
标题:求助!!怎样将excel的数据输入到自己写的程序,运算后导入回原excel的文件 ...
取消只看楼主 加入收藏
corpsetsui
Rank: 1
等 级:新手上路
帖 子:15
专家分:4
注 册:2016-3-4
结帖率:33.33%
收藏
已结贴  问题点数:20 回复次数:3 
求助!!怎样将excel的数据输入到自己写的程序,运算后导入回原excel的文件里面去
// 200.cpp : 定义控制台应用程序的入口点。

//

#include "stdafx.h"
#include <iostream>
#include<stdio.h>
#include <math.h>
#define MAXCOUNT 400
using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
        
        void firstdata(float,float,float);
        float L1,L2,L3;
        void secondata(float,float,float);
        float i,j,k;
                void thirddata(float,float,float);
                float C1,O1,
                C2,O2,C3,O3;
        int count;
                float a,b,c,p,q,r,A,B,C;
                float target1,target2,target3,plan1,plan11,plan2,plan21;
        count=0;
        L3=0;
        L2=0;
                L1=0;
        while(count<=MAXCOUNT)
        {
                printf("\n===============");
                if(L1==0)
                {
                    printf("\n第一输入距离值 ");
                         scanf_s("%f",&L1);
                         printf("-----1/0判断: ");
                         scanf_s("%f",&i);
                        printf("第一次目标开始值: ");
                        scanf_s("%f",&O1);
                        printf("第一次目标结束值: ");
                         scanf_s("%f",&C1);
                                        printf("\n==============");

                                        printf("\n第二输入距离值 ");
                         scanf_s("%f",&L2);
                         printf("-----1/0判断: ");
                         scanf_s("%f",&j);
                        printf("第二次目标开始值: ");
                        scanf_s("%f",&O2);
                        printf("第二次目标结束值: ");
                         scanf_s("%f",&C2);
                                        printf("\n==============");
                }
                else
                {
                        L1=L2;
                        L2=L3;
                                        i=j;                   /*待处理,输出结果不正常*/
                        j=k;

                                        C1=C2;
                    C2=C3;
                                        O1=O2;
                                        O2=O3;
                }               
               printf("\n第三输入距离值: ");
               scanf_s("%f",&L3);
               printf("-----上/下方向: ");
                   scanf_s("%f",&k);
                   printf("第三次目标开始值: ");
                   scanf_s("%f",&O3);
                   printf("第三次目标结束值: ");
                   scanf_s("%f",&C3);
                           printf("\n");

                           p=fabs(sqrt(L1*L1-1));
                           q=fabs(sqrt(L2*L2-1));
                           r=fabs(sqrt(L3*L3-1));
                           target1=C1-O1;
                           target2=C2-O2;
                           target3=C3-O3;
                           a=q/p;
                           b=r/q;
                           c=r/p;
                           A=fabs(target2/target1);
                           B=fabs(target3/target2);
                           C=fabs(target3/target1);
                           plan1=C3-2;
                           plan2=C3+2;
                           plan11=C3-6;
                           plan21=C3+6;

      if( i == 1 && j==1 && k==1)  /*1001---8672\\顺序号跳过-986*/
      {
                         if(L1<L2 && L2<L3 )/*End of 2910*/  //第一个
                         {
                                  if(target1 == target2 && target2  ==  target3 && target3 ==0 )
                                  {
                                          if(a>b)
                                          {
                                                  printf("-1001-ture");
                                          }
                                          else
                                                  printf("-1002-ture");
                                  }
                                  else if(fabs(target1) == fabs(target2) && fabs(target2) == fabs(target3) && target1 != 0)
                                  {
                                          if(a>b)
                                          {  
                                                  if(fabs(target1/p)>fabs(target2/q) && fabs(target2/q)>fabs(target3/r))
                                                  {
                                                         
                                                                  printf("-1003-ture");
        
                                                  }
                                                  else if(fabs(target1/p)>fabs(target2/q) && fabs(target2/q)<fabs(target3/r) && fabs(target1/p)>fabs(target3/r))
                                                  {
                                                         
                                                                  printf("-1004-ture");
                                                         
                                                  }
                                                  else if(fabs(target1/p)>fabs(target2/q) && fabs(target2/q)<fabs(target3/r) && fabs(target1/p)<fabs(target3/r))
                                                  {
                                                         
                                                                  printf("-1005-ture");
。。。。。。
后面还有很多的就不贴出来,程序运算时没有问题,只是手工输入很麻烦,想自动运算提高效率
提取数据的excel文件里面的格式是这样的
图片附件: 游客没有浏览图片的权限,请 登录注册
搜索更多相关主题的帖子: excel include 应用程序 控制台 count 
2016-05-26 11:49
corpsetsui
Rank: 1
等 级:新手上路
帖 子:15
专家分:4
注 册:2016-3-4
收藏
得分:0 
回复 2楼 rjsp
你好。
因为我本来也不太懂,因为excel只是手工写入数据的时候方便,那要什么样的格式去输入数据好呢?
 能详细说吗?谢谢你的解答!!
2016-05-27 00:12
corpsetsui
Rank: 1
等 级:新手上路
帖 子:15
专家分:4
注 册:2016-3-4
收藏
得分:0 
我可以用text来输入数据的,那程序的接口和出口要怎么编写呢?谢谢各位解答
2016-05-28 23:07
corpsetsui
Rank: 1
等 级:新手上路
帖 子:15
专家分:4
注 册:2016-3-4
收藏
得分:0 
那是添加到已经写好的程序的头,还是要怎么操作啊??
2016-06-03 16:55
快速回复:求助!!怎样将excel的数据输入到自己写的程序,运算后导入回原excel的 ...
数据加载中...
 
   



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

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