The c language converts lowercase letters in a string to uppercase letters

  • 2020-05-17 06:06:59
  • OfStack

describe

Given a string, convert all lowercase letters to uppercase letters.

The input

Enter 1 line containing 1 string (length not exceeding 100, possibly containing Spaces).

The output

Output the converted string.

The sample input

helloworld123Ha

Sample output

HELLOWORLD123HA


#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
char a[100001];
char ans[1001];
int now;
int main()
{
  gets(a);
  int l=strlen(a);
  for(int i=0;i<l;i++)
  {
    if(a[i]>=97&&a[i]<=122)a[i]=a[i]-32;
  }// Case conversion 
  
   puts(a);
  return 0;
}

Related articles: