C++ Program to check string is alphabet or not

In this program, You will learn how to check string is alphabet or not in C++.

Some list of alphabet string: xiith, john, amit, abc

alphabet string is called without integer.

Example: How to check string is an alphabet or not in C++.

using namespace std;

int main() {

    char str[100];
    int i = 0, k = 0, p;

    cout << "Enter string value:";
    cin.getline(str, 100);

    i = strlen(str);

    for (int j = 0; j < i; j++) {
        p = str[j];
        if (p >= 97 && p <= 122)
        else if (p >= 65 && p <= 90)
        else if (p == 32)

    if (k == i) {
        cout << "String is alphabet:" << str;
    } else {
        cout << "String is not alphabet:" << str;

    return 0;


Enter string value:Welcome to Xiith
String is alphabet:Welcome to Xiith

Xiith is created for educational, experimental, and schooling purpose. Examples on Xiith are made easier to make a better or basic understanding. Tutorials, testimonials, and examples are continuously checked to avoid delusion, but we cannot take complete responsibility of all programs on Xiith. When you are operating this site, you have to agree to read and accept our terms of use, cookie and privacy policy.Copyright © 2020 by Xiith. All Rights Reserved. About us.