- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我是一个初学者,我开始掌握一些东西,但我正在为这个人添加另一个部分到这个计算器。
我把它作为 main.cpp
,我为 selection == 5
添加了位:
#include <iostream>
#include <string.h>
using namespace std;
// Function includes
// I try to keep them in the order they appear in the
// output below for organization purposes
#include "calc.m.xy12plugin.cpp"
#include "calc.b.xymplugin.cpp"
#include "calc.m.xybplugin.cpp"
#include "calc.point.xymplugin.cpp"
#include "calc.parallelplugin.cpp"
// The above one would be here, too
int main(int argc, const char* argv[]) {
int i;
i = 0;
cout << "Linear Equation Calculator" << endl << "Copyright (c) 2011 Patrick Devaney" << endl
<< "Licensed under the Apache License Version 2" << endl;
// This loop makes the code a bit messy,
// but it's worth it so the program doesn't
// crash if one enters random crap such as
// "zrgxvd" or "54336564358"
while(i < 1) {
cout << "Type:" << endl
<< "0 to calculate a slope (the M value) based on two points on a line" << endl
<< "1 to calculate the Y-intercept (the B value) based on two points and a slope" << endl
<< "2 to calculate the slope (the M value) based on the Y-intercept and X and Y" << endl <<
"plug-ins" << endl
<< "3 to find the next point up or down a line based on the slope (M) and X and Y"
<< endl << "plug-ins" << endl
<< "4 to find a point x positions down the line based on the slope (M) and X and Y"
<< endl << "plug-ins" << endl
<< "5 to find the equation of a parallel line in form y=mx+c"
<< endl << "plug-ins" << endl;
string selection;
cin >> selection;
if(selection == "0") {
mcalcxyplugin();
i++;
}
else if(selection == "1") {
calcbxymplugin();
i++;
}
else if(selection == "2") {
calcmxybplugin();
i++;
}
else if(selection == "3") {
calcpointxymplugin(1);
i++;
}
else if(selection == "4") {
int a;
cout << "How many points up/down the line do you want? (Positive number for points" << endl
<< "further up, negative for previous points" << endl;
cin >> a;
calcpointxymplugin(a);
i++;
}
else if(selection == "5"){
calcparallelplugin();
i++;
}
else {
i = 0;
}
// End of that loop below
}
return 0;
}
然后我创建了这个链接到 else if(selection == "5"...
这是cal.parallelplugin.cpp
文件
#include <iostream>
using namespace std;
int main(){
cout <<"Welcome to the Parallel Line Calculator \n" << endl;
cout << "Here you will find the equation of the line parallel to a line passing through \na point (x,y) in the form y=mx+c \n\n" << endl;
float x,y, c, x1, y1, gradient, c1;
cout << "NOTE: Equation must be in form y=mx+c \n" << endl;
cout <<"Please enter the number of Xs:" <<endl;
cin >> x;
cout <<"Please enter the number of Ys:" <<endl;
cin >> y;
cout <<"Please enter the number of Cs:" <<endl;
cin >> c;
cout <<"Please enter the x co-ordinate:" <<endl;
cin >> x1;
cout <<"Please enter the y co-ordinate:" <<endl;
cin >> y1;
gradient= x/y;
c1 = y1 + (gradient*x1);
cout << "Equation of parallel line through (" << x1 << ", " << y1 << ") is " << "y=" << gradient << "x+" << c1 << endl;
}
编译时我没有得到错误,但是当我编译 main.cpp 时,我得到了以下错误,我无法用我的一生来找出问题所在 :(
C:\Users\George\Desktop\linear_equation_calc\main.cpp||In function 'int main(int, const char**)':|
C:\Users\George\Desktop\linear_equation_calc\main.cpp|51|error: declaration of C function 'int main(int, const char**)' conflicts with|
C:\Users\George\Desktop\linear_equation_calc\calc.parallelplugin.cpp|9|error: previous declaration 'int main()' here|
C:\Users\George\Desktop\linear_equation_calc\main.cpp||In function 'int main(int, const char**)':|
C:\Users\George\Desktop\linear_equation_calc\main.cpp|100|error: 'calcparallelplugin' was not declared in this scope|
||=== Build finished: 3 errors, 0 warnings ===|
帮助!
最佳答案
您有两个 main
函数。您应该只有一个 main
函数。
关于c++ - 错误 : declaration of C function conflicts with previous declaration,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10375948/
Postgres 10 和 11 的插入规范说: ON CONFLICT [ conflict_target ] conflict_action 我有一张 table : create table c
我的理解是conflict serializable 隐含serializable。我不确定这如何让他们与众不同。可序列化是否意味着冲突可序列化? 最佳答案 冲突可序列化是可序列化的一个子集,因此仅仅
在数据库理论中,“冲突可序列化”和“冲突等价”有什么区别? 我的教科书有一节是关于冲突可序列化的,但掩盖了冲突等价性。这些可能都是我熟悉的概念,但我不熟悉术语,所以我正在寻找解释。 最佳答案 DBMS
我有一个项目一直在 Xcode 4.4.1 中进行,我想回到以前的分支。(注意分支并不复杂,而是代表线性发展) 当我选择上一个分支时有一个警告 UserInterfaceState.xcusersta
我得到了一个 environment.ubuntu.yml文件,以便能够创建 conda 环境。但是,运行 conda create env --file environment.ubuntu.yml
我浏览了互联网,找不到我的问题的清晰简洁的答案。我想知道如果我将相同强度的信号驱动到同一根电线上会发生什么,其中一个是逻辑 1,另一个是逻辑 0?如果我想要一个“获胜”的信号,因为没有更好的词,我该怎
我在2个网站上有2个不同的图片: http://www.siteA.com/avatar.png http://www.siteB.com/avatar.png 如果我创建具有2个起源的Amazon
我正在 Labview 中开发一个数据采集程序,该程序使用多个转换阶段、相机、高速数字化仪和其他仪器。我正在一台计算机上开发该应用程序,并将其部署到另一台计算机上。开发计算机有labview 2013
能否请您帮助我理解为什么乐观并发更新会有这样的结果。 比如说,我有以下文件: { "phrase": "some phrase", "id": "5d1341797e2ed599", "_
我想安装这两个包: “anahkiasen/前任”:“开发大师” "vespakoen/menu": "dev-master" 但是 composer 说它们每个都依赖于这个包的不同版本: "anah
我在运行 powershell 时遇到以下错误 $thumbprint=$(az webapp config ssl upload --certificate-file $Path --certifi
我不太确定这是否是我使用的 SQLite 版本的问题。但实际上我并没有直接使用 native SQLite (dll),我使用的是 System.Data.SQLite 版本 1.0.108.0 看起
我有一个具有 iBeacon 服务和标准 BLE 服务的芯片。 我想使用 iBeacon 服务在进入 BLE 信号范围时触发我正在开发的应用。 激活后,我希望应用程序使用 CoreBluetooth
建表语句: ? 1
我使用此链接中的示例创建了测试 Telegram 机器人控制台应用程序 https://github.com/TelegramBots/Telegram.Bot.Examples 这是我的主要 pub
我有这个 hpp 文件: struct rte_spinlock_t; class A { public: void init(); private:
我已经从 GitHub 中提取了文件。现在我需要创建一个合并冲突。 如何在 GitHub 上故意创建合并冲突? 最佳答案 在两个分支中编辑同一行,并尝试合并 Merge conflicts in gi
我是这个 repo 的管理员。在这个 PR 中,我删除了多个文件并将这些更改从本地合并到源/开发。将 origin/develop 合并到 origin/master 时,我遇到了我删除的四个文件之一
我使用 Azure 表存储从 MVC 应用程序记录访问者信息,但有时会引发以下异常: [WebException: The remote server returned an error: (409)
我有一张 table : create table c ( e text not null, m text not null, p numeric not null,
我是一名优秀的程序员,十分优秀!