Z
zfareed
I am trying to sort a 2-dim array of students lastnames. I keep getting
errors that I cannot assign arrays.
void bubbleSort (char Lstname[][10], int n)
{
bool swapped = true;
while(swapped){
swapped = false;
for (int i = 0; i < 40 - 1 ; ++i)
if (Lstname > Lstname[i+1]) {
swap(Lstname, Lstname[i+1]);
swapped = true;
}
}
}
I get these error messages on compilation:
C:\Documents and Settings\Admin\My
Documents\C++\assignments\prog5.cpp:215: instantiated from here
C:/Dev-Cpp/include/c++/3.4.2/bits/stl_algobase.h:130: error: invalid
initializer
C:/Dev-Cpp/include/c++/3.4.2/bits/stl_algobase.h:131: error: ISO C++
forbids assignment of arrays
C:/Dev-Cpp/include/c++/3.4.2/bits/stl_algobase.h:132: error: ISO C++
forbids assignment of arrays
Execution terminated
errors that I cannot assign arrays.
void bubbleSort (char Lstname[][10], int n)
{
bool swapped = true;
while(swapped){
swapped = false;
for (int i = 0; i < 40 - 1 ; ++i)
if (Lstname > Lstname[i+1]) {
swap(Lstname, Lstname[i+1]);
swapped = true;
}
}
}
I get these error messages on compilation:
C:\Documents and Settings\Admin\My
Documents\C++\assignments\prog5.cpp:215: instantiated from here
C:/Dev-Cpp/include/c++/3.4.2/bits/stl_algobase.h:130: error: invalid
initializer
C:/Dev-Cpp/include/c++/3.4.2/bits/stl_algobase.h:131: error: ISO C++
forbids assignment of arrays
C:/Dev-Cpp/include/c++/3.4.2/bits/stl_algobase.h:132: error: ISO C++
forbids assignment of arrays
Execution terminated