#include<bits/stdc++.h>
using namespace std;
int main() {
int n;
cin>>n;
string s;
for(int i=0;i<n;i++){
std::getline (std::cin,s);
}
sort(s,s+n);
for(auto c:s){
cout<<s<<endl;
}
return 0;
}
What's wrong with code
whenever i initialise string like string s1; it gives an error
the doubts are written as comments in the code
- c should be printed here, not s. It will give correct output after you do this. “S” is an array of strings so if you print s, it will give the address of the first element of the array.
- please share the code which is giving the other errors im not getting what syntax you are using for those
this is the same code just have declared string differently
(string s instead of string s[100])
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.