get rid of the keyword auto
This commit is contained in:
@@ -185,8 +185,10 @@ int main() {
|
|||||||
|
|
||||||
// Print the original list
|
// Print the original list
|
||||||
std::cout << "Original list:" << std::endl;
|
std::cout << "Original list:" << std::endl;
|
||||||
for (const auto& person : people) {
|
std::list<Person>::iterator itr = people.begin();
|
||||||
std::cout << person.name << " (" << person.age << ")" << std::endl;
|
while(itr != people.end()){
|
||||||
|
std::cout << (*itr).name << " (" << (*itr).age << ")" << std::endl;
|
||||||
|
++itr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sort the list of Person objects using the custom comparison function
|
// Sort the list of Person objects using the custom comparison function
|
||||||
@@ -194,8 +196,10 @@ int main() {
|
|||||||
|
|
||||||
// Print the sorted list
|
// Print the sorted list
|
||||||
std::cout << "\nSorted list:" << std::endl;
|
std::cout << "\nSorted list:" << std::endl;
|
||||||
for (const auto& person : people) {
|
itr = people.begin();
|
||||||
std::cout << person.name << " (" << person.age << ")" << std::endl;
|
while(itr != people.end()){
|
||||||
|
std::cout << (*itr).name << " (" << (*itr).age << ")" << std::endl;
|
||||||
|
++itr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -27,8 +27,10 @@ int main() {
|
|||||||
|
|
||||||
// Print the original list
|
// Print the original list
|
||||||
std::cout << "Original list:" << std::endl;
|
std::cout << "Original list:" << std::endl;
|
||||||
for (const auto& person : people) {
|
std::list<Person>::iterator itr = people.begin();
|
||||||
std::cout << person.name << " (" << person.age << ")" << std::endl;
|
while(itr != people.end()){
|
||||||
|
std::cout << (*itr).name << " (" << (*itr).age << ")" << std::endl;
|
||||||
|
++itr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sort the list of Person objects using the custom comparison function
|
// Sort the list of Person objects using the custom comparison function
|
||||||
@@ -36,10 +38,11 @@ int main() {
|
|||||||
|
|
||||||
// Print the sorted list
|
// Print the sorted list
|
||||||
std::cout << "\nSorted list:" << std::endl;
|
std::cout << "\nSorted list:" << std::endl;
|
||||||
for (const auto& person : people) {
|
itr = people.begin();
|
||||||
std::cout << person.name << " (" << person.age << ")" << std::endl;
|
while(itr != people.end()){
|
||||||
|
std::cout << (*itr).name << " (" << (*itr).age << ")" << std::endl;
|
||||||
|
++itr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user