0

rearrange array

how can i rearrange array setting special characters first then letter then numbers? it should be arranged by ascii value can anyone help?

15th Nov 2023, 11:36 AM
sayo
sayo - avatar
12 odpowiedzi
+ 2
At first seperate the array on the basis of symbol, letter and number and then sort them using their ASCII value
15th Nov 2023, 12:06 PM
Ayush Singh
Ayush Singh - avatar
+ 2
sayo i prefer you to do introduction for c++ course first instead of intermediate course cuz it will help you to understand the basic of C++ like loops,if/else,switch,arrays ,data types and moew!
15th Nov 2023, 2:25 PM
Alhaaz
Alhaaz - avatar
+ 1
i didn't learn java so i won't understand, anyway thank a lot Ayush Singh i will try more
15th Nov 2023, 1:20 PM
sayo
sayo - avatar
+ 1
Alhaaz how to use the vector?
15th Nov 2023, 1:21 PM
sayo
sayo - avatar
+ 1
sayo , by applying <vector> header file in your code , i think you are currently a beginner so i prefer you to use arrays right now!
15th Nov 2023, 2:19 PM
Alhaaz
Alhaaz - avatar
+ 1
Alhaaz u r right thank u I'll try
15th Nov 2023, 2:22 PM
sayo
sayo - avatar
0
this is array before {3,c,2,$,b,a,!,1} and this after using the rearrange function {!, $, a, b, c, 1,2,3}
15th Nov 2023, 11:45 AM
sayo
sayo - avatar
0
how can i sort it first? can you give me the implementation
15th Nov 2023, 12:11 PM
sayo
sayo - avatar
0
Let me try but I can give it you in Java
15th Nov 2023, 12:14 PM
Ayush Singh
Ayush Singh - avatar
0
you can use vector too!
15th Nov 2023, 12:14 PM
Alhaaz
Alhaaz - avatar
0
sayo not quite sorted the way you wanted, but sorted nevertheless. The answer should be use std::sort from <algorithm> https://code.sololearn.com/cbZ9EPs6nNvV/?ref=app
17th Nov 2023, 9:00 AM
Bob_Li
Bob_Li - avatar
0
Bob_Li thanks a lot, it is so helpful
17th Nov 2023, 9:48 AM
sayo
sayo - avatar