I'm supposed to create a c++ program which is supposed to take a sentence as an...

90.2K

Verified Solution

Question

Programming

I'm supposed to create a c++ program which is supposed to take asentence as an input and then output a sorted list of theoccurrence of each letter.

ex.

Enter a phrase: It's a hard knock life

A2

I2
K2

C1

D1

E1

F1

H1

L1

N1

O1

R1

S1

T1

I was also given a recommended code to use as a bubble sort

procedure bubbleSort( A : list ofsortable items )

n = length(A)
repeat

swapped = false

for i = 1 to n-1 inclusive do

/* if this pair is out of order */ ifA[i-1] > A[i] then

/* swap them and remember somethingchanged */ swap( A[i-1], A[i] )
swapped = true

end if end for

until not swapped

end procedure

Answer & Explanation Solved by verified expert
3.9 Ratings (536 Votes)
include using namespace stdvoid    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students