View Code of Problem 43

#include<iostream>
#include <cmath>
using namespace std;
#pragma warning(disable:4996)

int main(){
	char s[100];
	gets_s(s);
	int n = strlen(s);
	for (int i = 0; i < n; i++) {
		if (s[i] >= 'a'&&s[i] <= 'z' || s[i] >= 'A'&&s[i] <= 'Z') {
			printf("%c", s[i]);
		}
	}
	return 0;
}
/*
Main.cc:4:0: warning: ignoring #pragma warning  [-Wunknown-pragmas]
 #pragma warning(disable:4996)
 ^
Main.cc: In function 'int main()':
Main.cc:8:10: error: 'gets_s' was not declared in this scope
  gets_s(s);
          ^
Main.cc:9:18: error: 'strlen' was not declared in this scope
  int n = strlen(s);
                  ^
Main.cc:11:18: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   if (s[i] >= 'a'&&s[i] <= 'z' || s[i] >= 'A'&&s[i] <= 'Z') {
                  ^
*/

Double click to view unformatted code.


Back to problem 43