Computer Science, asked by divyanshi2112, 9 months ago

write a menu driven program to generate the upper case letters from Z toA and lower case letters from 'a' to 'z' as per the user's choice.
Enter '1' to display upper case letters from Z to A and enter '2' to display lower case letters from a to z​

Answers

Answered by Anonymous
5

Answer:

// C++ program to print alphabets

#include <iostream>

using namespace std;

// Function to print the alphabet

// in lower case

void lowercaseAlphabets()

{

// lowercase

for (int c = 97; c <= 122; ++c)

cout << c << " ";

cout << endl;

}

// Function to print the alphabet

// in upper case

void uppercaseAlphabets()

{

// uppercase

for (int c = 65; c <= 90; ++c)

cout << c << " ";

cout << endl;

}

// Driver code

int main()

{

cout << "Uppercase Alphabets" << endl;

uppercaseAlphabets(ch);

cout << "Lowercase Alphabets " << endl;

lowercaseAlphabets(ch);

return 0;

}

Answered by Anonymous
8

Answer:

Program to display all alphabets from A to Z in uppercase and lowercase both

Alphabets in lowercase and uppercase can be printed using two methods, first is using ASCII values and second is to directly print values from ‘A’ to ‘Z’ using loops. Below are the implementation of both methods:

Using ASCII values:

ASCII value of uppercase alphabets – 65 to 90.

ASCII value of lowercase alphabets – 97 to 122.

// C++ program to print alphabets

#include <iostream>

using namespace std;

// Function to print the alphabet

// in lower case

void lowercaseAlphabets()

{

// lowercase

for (int c = 97; c <= 122; ++c)

cout << c << " ";

cout << endl;

}

// Function to print the alphabet

// in upper case

void uppercaseAlphabets()

{

// uppercase

for (int c = 65; c <= 90; ++c)

cout << c << " ";

cout << endl;

}

// Driver code

int main()

{

cout << "Uppercase Alphabets" << endl;

uppercaseAlphabets(ch);

cout << "Lowercase Alphabets " << endl;

lowercaseAlphabets(ch);

return 0;

}

Similar questions