Why this template can't accept a whole word? C++ | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

Why this template can't accept a whole word? C++

I have this code, where I want to add a song name to the list, the problem is, when I tried to add for example "happy together", the program breaks and start and infinite loop, dunno understand why, if my template should recieve a std:: string. It only accepts one letter. My program is seperate in two files, Main.cpp and Lista.hpp. In lista.hpp you will find the class template. My main idea is to do the list Operation (insert, delete, find, etc.) And I want to do it with a template, it works fine with integers but with std:: string no... Hope someone can help me, thank you so much! https://code.sololearn.com/W98TntmN8mR0/?ref=app

8th Feb 2019, 5:29 AM
Eduardo Perez Regin
Eduardo Perez Regin - avatar
2 ответов
+ 1
YOU ARE COMPILING YOUR C++ PROGRAM IN HTML.. Please choose C++ compiler.
15th Feb 2019, 1:00 PM
Dastageer
Dastageer - avatar
0
Oh Dastageer haha good point, but the code it's just for visually representation, because I don't compile in sl, I will change it
15th Feb 2019, 2:12 PM
Eduardo Perez Regin
Eduardo Perez Regin - avatar