- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在此代码中,keepSelectedFiles 有 5 个文本文件。我想选择其中的 3 个并添加到另一个数组 keepFiles 中。计数只是用户的输入。如果用户在文本框中选择 3,则计数为 3 任意数字等。
for (int i = 0; i < keepSelectedFiles.GetSize(); i++)
{
for (int i = 0; i < count; i++)
{
keepFiles.RemoveAt(keepFiles.IsEmpty());
keepFiles.Add(keepSelectedFiles[i]);
testbox6.AddString(keepFiles[i]);
}
}
请帮我看看我该怎么做?
最佳答案
这是实现它的方法(性能优化):
if (count < 0)
return; // error handling
if (count < keepSelectedFiles.GetSize())
{
keepFiles.SetSize(count);
for (int i=0; i<count; i++)
{
keepFiles[i] = keepSelectedFiles[i];
}
}
else
{
keepFiles.Copy(keepSelectedFiles);
}
关于c++ - 在 CStringArray 中从 5 个元素中选择 3 个元素?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29642574/
我有一个对话框,它以 CStringArray 的形式从列表框中返回多项选择的结果,我将返回的结果传递给线程以处理文件。我像这样在线程中引用数组: CStringArray* m_CStringArr
我是编码新手,所以我可能有点慢。 所以我有一个用户输入的方程式的 CString,我想将数字和运算符分开,以便它们在 CStringArray 中有自己的索引。 例如,这就是我的意思: 我有一个字符串
我是 C++ 世界的菜鸟,我面临着一种奇怪的行为。我使用 Visual Studio 2010。 上下文:我决定将 wxWidget 用于 GUI。 为此,我必须在我的项目属性中更改以下设置: C/C
在此代码中,keepSelectedFiles 包含 5 个文本文件。 keepFiles 包含来自 keepSelectedFiles 的 3 个文本文件。我只想比较这两个数组,然后从 keepSe
我试图返回一个 CStringArray:在我的“.h”中,我定义了: Private: CStringArray array; public: CStringArra
此代码每次都在调试器中显示 Cat。第一次和第二次。但我想在调试器中第一次显示 Cat,然后在第二次调试器中显示 Dog。 int main(){ CStringArray arr;
我有这样的字符数组 char *a[]={"hi","hello","how are you"}; 我想把它转换成CStringArray 我该怎么做? 最佳答案 char *a[] = { "hi"
这是 C++ Win32 程序。我做了一个方法,但是这个没有编译。 我预计问题的原因是使用 CStringArray 作为方法的参数。 Ipc3dxContainerPtr KmCdmMakeMult
得到这段代码: CString CMeetingScheduleAssistantApp::UpdateDateFormatString(COleDateTime& rDate, CString st
我开发了一个 MFC dll,其中包含一个具有以下原型(prototype)的函数: //DLL code long __declspec(dllexport) GetData(CString csI
问题是如果我只使用 CStringArray 而不是 CSortStringArray 如何排列顺序 第一个数组 sortarray 的排列是从 (a 到 m) 的顺序。但是,如果我使用 CSortS
如问题所述,我想复制 CStringArray 的内容进入std::vector . 有什么建议么? 最佳答案 因为CStringArray也是分配在一个线性数组中,所以不需要循环。只需使用插入函数并
我有一个 CStringArray,我想在其上调用 CString::MakeUpper() 以将其设为大写。 我正在这样尝试: mycstringarray.GetAt(0).MakeUpper()
在此代码中,keepSelectedFiles 有 5 个文本文件。我想选择其中的 3 个并添加到另一个数组 keepFiles 中。计数只是用户的输入。如果用户在文本框中选择 3,则计数为 3 任意
我收到一个奇怪的错误,告诉我在简单地尝试将 CStringArray 传递给我编写的将其分解成多个部分的函数时,我无法访问类“CObject”中声明的私有(private)成员。我已经注释掉了我的整个
我是一名优秀的程序员,十分优秀!