假设我有 2 个或更多具有相同名称但数据格式不同的文件:
- 文件.txt
- 文件.cpp
- 文件.h
- 文件.hpp
- ...ETC。
这是否被视为“超载”文件?
假设我有 2 个或更多具有相同名称但数据格式不同的文件:
这是否被视为“超载”文件?
我有一个事件函数,当释放鼠标时调用,当两个形状叠加时,它们应该被“合并”,并且应该在这个地方创建另一个形状。
void __fastcall TForm1::ShapeMouseUp(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y)
{
TShape* shape = dynamic_cast<TShape*>(Sender);
if (shape) {
shape->Tag = 0;
if (!Panel1->BoundsRect.Contains(shape->BoundsRect)) {
shape->Left = TagFloat;
shape->Top = TagFloat2;
}
else {
// Проверяем наложение на другие квадраты
for (int i = 0; i < Panel1->ControlCount; ++i) {
TShape* otherShape = dynamic_cast<TShape*>(Panel1->Controls[i]);
if (otherShape && otherShape != shape) {
if (shape->BoundsRect.IntersectsWith(otherShape->BoundsRect)) {
//Application->MessageBox(L"Условие выполнилось", L"Тест");
int left = std::max(shape->Left, otherShape->Left);
int top = std::max(shape->Top, otherShape->Top);
int right = std::min(shape->Left + shape->Width, otherShape->Left + otherShape->Width);
int bottom = std::min(shape->Top + shape->Height, otherShape->Top + otherShape->Height);
int intersectionWidth = right - left;
int intersectionHeight = bottom - top;
if (intersectionWidth > 0 && intersectionHeight > 0 && intersectionWidth * intersectionHeight > 0.5 * shape->Width * shape->Height) {
TShape* newShape = new TShape(Panel1);
newShape->Parent = Panel1;
newShape->Width = shape->Width;
newShape->Height = shape->Height;
newShape->Left = shape->Left;
newShape->Top = shape->Top;
newShape->Shape = stEllipse;
newShape->Brush->Color = clRed;
newShape->OnMouseDown = ShapeMouseDown;
newShape->OnMouseMove = ShapeMouseMove;
newShape->OnMouseUp = ShapeMouseUp;
Panel1->RemoveControl(shape);
Panel1->RemoveControl(otherShape);
delete shape;
delete otherShape;
break;
}
}
}
}
}
}
}
但问题恰恰是条件不满足
有这2个函数:
1.
#include <iostream>
int ReturnIntX(int x) {
if (x == 1) {
return x;
}
}
int main()
{
int a = 1;
int b = ReturnIntX(a);
}
#include <iostream>
int ReturnInt1(int x) {
if (x == 1) {
return 1;
}
}
int main()
{
int a = 1;
int b = ReturnInt1(a);
}
以前的启动/后台进程与此有什么关系吗?
我有兴趣知道什么会更快:返回传递的参数,还是文字值?毕竟,如果你想一想,变量x即使是空的,也可以有“权重”,如果它也有值,那么“权重”就会增加
PS:您能推荐一些用于自测试的库吗?