convert uppercase to lowercase in c code example

Example 1: to upper in c

#include <ctype.h> // For function below

Example 2: in c, is class uppercase or lowercase

class /*class name here*/ {
 
  /* inser all the things you do in a class
  here because you can and that is what you 
  do*/
  
}

Example 3: convert string to lowercase in c

// include all the libraries  used in the program.
#include <stdio.h>
#include <cs50.h>
#include <ctype.h>
#include <string.h>
#include <math.h>

// Base Function
int main(int argc, string argv[])
{
    if (argc != 2)
    {
        printf("Usage: ./substitution key\n");
    }
    else if (strlen(argv[1]) != 26)
    {
        printf("Key must contain 26 characters.\n");
    }
    
    string key = argv[1].toupper();
    string key = argv[1].tolower();
}

Tags:

Cpp Example