0
Symbols cod coach (fails case #4 & case #5)
it passes all the others but I dont know what the problem is i thought it was for the output and it has to be a string instead of char array but it was not the problem https://code.sololearn.com/cuea1tofah3I/#cpp #include <iostream> #include <string> using namespace std; int main () { string input ; int j =0 ; char temp[30]; getline (cin, input); for (int i = 0 ; input[i] ; i++ ){ if ((input[i]>='a'&&input[i]<='x')||(input[i]>='A'&& input[i]<='Z')||(input[i]==' ')||(input[i]>'0'&& input[i]<'9')){ temp[j++]=input[i]; } } string s ; temp [j+1]='\0'; for (int k = 0;k<j;k++) {s=s+temp[k];} cout<< s ; return 0 ; }
7 Antworten
+ 2
#include <iostream>
#include <string>
#include <ctype.h>
using namespace std;
int main() {
string s;
getline(cin,s);
for(unsigned i=0;i<s.length();i++){
if(isalpha(s[i]) || isdigit(s[i]) || isspace(s[i])){
cout<<s[i];
}
else{
continue;
}
}
return 0;
}
This is a simpler approach and easy for anyone to understand.
I Don't know what is the problem with your code between.
+ 2
these are secret cases so i dont know more than you
+ 1
You should add more information about the failure of your test
+ 1
Could you put the text of this case? :)
+ 1
I mean, what is the object of your case? What would you do with this code?
0
it's hidden
0
It's challenge in code coach if you have mobile app of solo learn you can have access to these