View Code of Problem 43

#include <iostream>
#include <string.h>
using namespace std;

int main(){
  char str[91];
  cin>>str;
  len = strlen(str);
  for(int j = 0;j < len;j ++){
    if(str[j]>='a'&&str[j]<='z'||str[j]>='A'&&str[j]<='Z')
      printf("%c",str[j]);
  }
  return 0;
}
/*
Main.cc: In function 'int main()':
Main.cc:8:3: error: 'len' was not declared in this scope
   len = strlen(str);
   ^
Main.cc:10:19: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
     if(str[j]>='a'&&str[j]<='z'||str[j]>='A'&&str[j]<='Z')
                   ^
*/

Double click to view unformatted code.


Back to problem 43