0

C++ program assignment

Write a program which 1. Reads the size of a list of characters 2. Reads the list of characters 3. Prints the list of characters in the opposite order read in 4. Prints the list of characters in the order read in 5. Sorts the list 6. Prints the sorted list example: Size = 4 alphabet = a albhabet =b alphabet = c alphabet = d In reverse order d c b a In normal order a b c d In sorted form c d b a

13th Nov 2018, 12:50 PM
Krinish Ihahs
16 Answers
+ 9
Your welcome, sure happy to help you.
13th Nov 2018, 2:17 PM
blACk sh4d0w
blACk sh4d0w - avatar
+ 8
1) You need to make a dynamic array of size N+1. N will be inputted by the user. 2) After creating array of size N+1, +1 is an extra slot for null/string terminating character. Run a loop from 0 to less than N-1 and keep taking inputs. 3) Now print the array from 0 to less than N-1, it will print the array in the way it is. 4) Then print the array from N-1 to 0, it will print the array in reverse order the array is filled. 5) Then apply any sorting algorithm on the array and then repeat steps 3 and 4
13th Nov 2018, 2:07 PM
blACk sh4d0w
blACk sh4d0w - avatar
+ 8
Then you can make three functions 1) void PrintArray() ; 2) void PrintReverseArray() ; 3) void SortArray() ;
13th Nov 2018, 2:15 PM
blACk sh4d0w
blACk sh4d0w - avatar
+ 7
Where is your try?
13th Nov 2018, 1:28 PM
blACk sh4d0w
blACk sh4d0w - avatar
+ 7
You can post a link to your code
13th Nov 2018, 1:34 PM
blACk sh4d0w
blACk sh4d0w - avatar
+ 7
Ok, but let me ask some thing so that I can help you better. What's the size of list? I mean if we input 6 then do we have to input 6 alphabets? Then we need to print the alphabets in the same way the alphabets are inputted?
13th Nov 2018, 1:40 PM
blACk sh4d0w
blACk sh4d0w - avatar
+ 7
It depends, if you need the snippet of code again and again then you can make your own functions or you can do whole thing in the main function. I would suggest you to make a separate functions for printing the array in normal way and in the reverse order because you'll be needing them at least twice
13th Nov 2018, 2:13 PM
blACk sh4d0w
blACk sh4d0w - avatar
+ 1
okay ill start working on it and will seek for your assistance if needed in between...thanks man
13th Nov 2018, 2:16 PM
Krinish Ihahs
0
how do i write in my code?? here in the comments??
13th Nov 2018, 1:32 PM
Krinish Ihahs
0
i have done the program in laptop btw.....so i dunno how that works
13th Nov 2018, 1:34 PM
Krinish Ihahs
0
could you look at the instructions and just give me few steps and guides? i'll just pick it from there....i wanna do it myself but just so utterly lost how to
13th Nov 2018, 1:35 PM
Krinish Ihahs
0
the size of the list is said to be set for 1000 thats the limit
13th Nov 2018, 1:41 PM
Krinish Ihahs
0
it says to keep it 1000 in a manner that it can be changed whenever we like....i believe its something like const int SIZE = 1000
13th Nov 2018, 1:42 PM
Krinish Ihahs
0
and we need to display the alphabets in three manners, one in the reverse order of what we input i.e if a b c d then d c b a , next is in normal order the same way we input like a b c d into a b c d itself and finally sorting the alphabets we input in ascending descending or alphabetical way
13th Nov 2018, 1:53 PM
Krinish Ihahs
0
okay i got the basic structure of the program....to print the array....what should i be using? like i need to have a separte void function of any sort?
13th Nov 2018, 2:09 PM
Krinish Ihahs
0
im asking because the instructions had one other condition....it said to use atleast 3 other functions so i believe i need to use void and stuffs
13th Nov 2018, 2:12 PM
Krinish Ihahs