+ 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
2 Answers
+ 1
and move cin>>str to before int size = str.length()
+ 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;
}