初始化程序错误无效 [英] invalid initialiser error
本文介绍了初始化程序错误无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
错误是在int [4] = ItemID,t;
我正在尝试使用ItemID对我的文本文件stockdatabase.txt中的项目进行排序,以降序排序。 br $>
the error is on int a[4] = ItemID,t;
I am trying to sort the items from my text file "stockdatabase.txt" using ItemID to sort in descending order.
void Transaction::SortDescending()
{
getStockTotal();
system("clear");
sort(ItemID);
cout<< ("stockdatabase.txt");
cout << logo_Descending << endl;
Myfile.open("stockdatabase.txt");
void sort(int &ItemID);
{
int a[4] = ItemID,t;
for (int e=0; e<4; e++)
{
for (int r =3; r>=e; r--)
{
if (a[e]<a[r])
{
>
t = a[r];
a [r] = a [e];
a[e] = t;
}
}
}
}
}
推荐答案
Of当然这条线完全无效。对我来说,很难想象这行可能意味着什么,这与C ++语法无关。一个问题是你甚至没有显示ItemID
和t
的声明。
例如,这里解释了数组的初始化: http://www.cplusplus .com / doc / tutorial / arrays / [ ^ ]。
-SA
Of course this line is totally invalid. To me, it's hard to even imagine what could you possibly mean by this line, which has nothing to do with C++ syntax. And one problem is that you did not even show the declarations forItemID
andt
.
Initialization of arrays is explained, for example, here: http://www.cplusplus.com/doc/tutorial/arrays/[^].
—SA
这篇关于初始化程序错误无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文