我正在为我的工作制作一个小程序(它与编程无关),以帮助他们完成许多测量和工作效率。
我使用Code :: Blocks在C ++的Console App中创建了大部分程序。
是否有可能从我的C ++中提取变量的输出并将它们放在Excel电子表格中的某些单元格中?我已经浏览了一些论坛的互联网,但有些不工作或让我使用Visual Basics。任何线索或提示都会有很大帮助。谢谢。
源代码:
#include <iostream>
#include <cstdlib>
#include <cmath>
//Function Prototypes -- *
void DisplayMenu();
void Bahama();
int Colonial();
int StormPanel();
void DisplayMenu()
{
int a;
std::cout << "*---Display Menu---*\n";
std::cout << "1) Bahama/Colonial\n";
std::cout << "2) Strom Panel\n\n";
std::cout << "Type the corresponding number for\n";
std::cout << "the type of shutter you need calculated: ";
std::cin >> a;
switch(a)
{
case 1:
Bahama();
break;
case 2:
StormPanel();
break;
}
}
void Bahama()
{
int Token = 200;
do{
int SN; //Shutter Number
int QSL; // Quantity of Shutter Louvers
double W; //Width
double H; //Hight
double Sl; // Shutter Louvers (trail)
double SL; // Size of Shutter Louvers
float Sd = 3.7812; // Single Deduction
float Dd = 5.6562; // Double Deduction
float Td = 7.5312; // Triple Deduction
float Qd = 9.4062; // Quadruple Deduction
float QTd = 11.2812; // Quintuple Deduction
float STd = 13.1562; // Sextuple Deduction
float HL; // Hight multiplied by Length
system("cls");
std::cout << "*----------------------------------------*\n\n";
std::cout << "What is the Width of the Bahama/Colonial shutter?\n";
std::cout << "(Whole Number or Decimal[Inches]): ";
std::cin >> W;
std::cout << "*----------------------------------------*\n\n";
std::cout << "What is the Hight of the Bahama/Colonial shutter?\n";
std::cout << "(Whole Number or Decimal[Inches]): ";
std::cin >> H;
HL = W*H;
system("cls");
std::cout << "*---------------------------------------------------------
----
---------------------------------------*\n\n";
std::cout << "Is this Shutter a . . ." << "\n" << "Single (1), Double
(2),"
<< "\n" << "Triple (3), Quadruple (4)," << "\n" << "Quintuple (5), or
Sextuple
(6): ";
std::cin >> SN;
switch (SN)
{
case 1: Sl = W - Sd;
break;
case 2: Sl = W - Dd;
break;
case 3: Sl = W - Td;
break;
case 4: Sl = W - Qd;
break;
case 5: Sl = W - QTd;
break;
case 6: Sl = W - STd;
break;
default: Sl = W - Sd;
}
SL = Sl / SN;
std::cout << "\n\nWith a Width of [" << W <<"] and a Hight of [" << H <<
"]";
std::cout << " the Bahama/Colonial Shutters'. . .";
std::cout << "\n\nSide Slide: ";
std::cout << W - 3.3125;
std::cout << "\n\nSide Rails: ";
std::cout << H - 3.7187;
std::cout << "\n\nLouver Size: ";
std::cout << SL;
// std::cout << "\n\nNumber of Louvers: ";
// std::cout << NP;
std::cout << "\n\n*-----------------------------------------------------
----
-------------------------------------------*\n\n\n";
std::cout << "Would you like to measure out another Bahama/Colonial
shutter?";
std::cout << "(1 = Yes)(2 = Main Menu)(0 = Quit): ";
std::cin >> Token;
switch (Token)
{
case 2: DisplayMenu();
case 0: Token = 200;
}
} while (Token == 1);
}
int StormPanel()
{
std::cout << "Storm Panel!";
return 0;
}
int main()
{
DisplayMenu();
return 0;
}
答案 0 :(得分:1)