Question: In c++ How would you sort an array by comparing a position in the array. {city: Houston, age: 19, name:joe} {city: Dallas, age: 18, name:Andrew}
In c++ How would you sort an array by comparing a position in the array.
{city: Houston, age: 19, name:joe}
{city: Dallas, age: 18, name:Andrew}
{city: Austin, age: 20, name:bob}
Let's say you have to sort this array by city. How would you get the position the city's name starts at (position 7 from the beginning) and compare each
example:
the H in houston {city: [H]ouston....}
the D in dallas {city: [D]allas....}
the A in Austin {city: [A]ustin....}
so comparing H, D, A so the array sorted looks like this
{city: Austin, age: 20, name:bob}
{city: Dallas, age: 18, name:Andrew}
{city: Houston, age: 19, name:joe}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
