0

Does anyone explain this in C++ or convert this into c++. https://code.sololearn.com/cDOpUuLAB6U5/?ref=app

You are making a call center application, which should handle customers in a queue. The CallCenter class is implemented as a Queue. Each element of the queue has the topic of the call as its value. The two possible values are 'general' and 'technical'. A 'general' call takes on average 5 minutes to handle, while a 'technical' call requires 10 minutes. The given code adds multiple customers to the Queue from user input. You need to dequeue all added customers, calculate and output the total time required to handle all calls. class CallCenter: def __init__(self): self.customers = [] def is_empty(self): return self.customers == [] def add(self, x): self.customers.insert(0, x) def next(self): return self.customers.pop() c = CallCenter() time_count=0 while True: n = input() if n == 'end': break c.add(n) if n=="general": time_count+=5 elif n=="technical" time_count +=10 c.next() print(time_count)

19th Sep 2022, 1:18 PM
Edis roy
3 odpowiedzi
+ 2
From your profile I can see that you are almost done with the C++ course. What have you tried so far? Please link your code attempt and we can suggest how to continue!
19th Sep 2022, 1:26 PM
Lisa
Lisa - avatar
+ 2
Seems like you are attempting advance concept before completing basics.. So better to revise basic concepts again. You have incorrect extra/less use of braces { , } about while loop.. and switch() block is not closed. Main is closed before already.. Why you have while( condition) ; after switch block? Your constrictor is in wrong declaration. CallCenter() { // .. Code } But you have CallCenter cc() { .. } It's not a constructor. You declared customers array as string time but assigning 0 integer type. It's error. If you Initialize memory then all position assigned to default value. No need loop to assign all values. Just initialize memory. Look 1 by 1.. Hope it helps to identify your mistakes..
19th Sep 2022, 2:13 PM
Jayakrishna 🇮🇳
19th Sep 2022, 1:50 PM
Edis roy