Question:
Write a console program?
anonymous
2012-06-14 07:18:31 UTC
Write a console program that repeatedly prompts the user to enter data until they type done (any case, Upper, Lower, or Mixed). As they enter the data, assign it to a two-dimension array where the first dimension contains exactly what they type and the second dimension contains the first non-whitespace character of what they type, in lowercase. If they enter a blank line, it is acceptable to skip that line. When they type done, do these steps:

1. display: As Entered

2. for each entry in the array, display the index of the first dimension, the second dimension's value, and the first dimension's value on a single line separated by : (colon).

3. display: Bubble Sorted

4. using a bubble sort, for each entry in the array, display the original index of the first dimension, the second dimension's value, and the first dimension's value on a single line separated by : (colon) sorted by the second dimension.

5. display: Selection Sorted

6. using a selection sort, for each entry in the array, display the original index of the first dimension, the second dimension's value, and the first dimension's value on a single line separated by : (colon) sorted by the first dimension.

Example:

User types:
apple
Apple
Zone
apple
done

You display:
As entered
0:a:apple
1:a:Apple
2:z:Zone
3:a:apple
Bubble Sorted
0:a:apple
1:a:Apple
3:a:apple
2:z:Zone
Selection Sorted
1:a:Apple
0:a:apple
3:a:apple
2:z:Zone
Four answers:
?
2012-06-14 09:01:51 UTC
Try this code (C++):

http://pastebin.com/us5LcJhA



edit: I sorted by the lowercase first dimension instead of the second... because otherwise it's retarded and not truly sorted.
anonymous
2016-10-04 07:23:58 UTC
The oldest supported OS for .information superhighway is residing house windows ninety 8. Are those machines quite so historic Win98 isn't an selection? (Of route, they could could get a valid Win98 license as reliable, which isn't loose). yet i could sense you're able to come across some very almost loose packing boxes with Win98 already time-honored for now no longer too much money. in simple terms tell the IT adult males to spend their weekends vacationing storage income ;-) If it really is not any longer an selection, you'll manage to usually be stuck doing this in C or C++. and also you're going to could hit upon a 16-bit compiler. no longer maximum of those left. speedy C, MSVC a million.6, OpenWatcom (link). yet yeah, those are quite primitive equipment by technique of cutting-edge-day specs. in case you code carefully, you probable powerfuble to jot down down and debug most of the app as a Win32 Console software, then recompile utilizing a 16-bit compiler for the finest output. you're able to wrap all the serial IO and more often than not some different concerns interior of a library or set of wrapper amenities, and characteristic 2 sorts of those amenities, pondering the very indisputable reality that serial IO could be very exceptional in residing house windows vs. DOS. and also you may also run into timing complications in which concerns artwork tremendous on a really computer, although fail on an outdated field as for this reason of it being slower. no longer a chilled undertaking.
TheMadProfessor
2012-06-14 07:39:33 UTC
So, what's the question - or did you just expect someone to do it all for you?
Cronin
2012-06-14 07:26:32 UTC
What language????


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...