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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started