Why did only 16 lines of code gave me tonnes of errors? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Why did only 16 lines of code gave me tonnes of errors?

Idk what is going on. https://code.sololearn.com/c3QWRB1ZY0la/?ref=app

5th Jul 2020, 2:29 PM
Purple Requiem
Purple Requiem - avatar
2 Answers
+ 1
and move cin>>str to before int size = str.length()
5th Jul 2020, 2:40 PM
Taste
Taste - avatar
+ 1
#include <iostream> using namespace std; int main() { string str; string newstr; getline(cin,str); int size=str.size(); for (int x=0;x<size;x++){ if (!isspace(str[x])){ newstr = newstr+str[x]; } } cout << newstr; return 0; }
5th Jul 2020, 3:00 PM
Shobhith J B
Shobhith J B - avatar