Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

Can we make a bot say the ABC? If so, how?

+2 votes
asked Nov 25, 2020 by Superman365 (560 points)

Can we make A bot say the ABC? 

It should go like this:

A

B

C

D

E

F

G

H

I

J

K

L

M

N

O

P

Q

R

S

T

U

V

W

X

Y

Z

smiley

1 Answer

+1 vote
answered Nov 25, 2020 by Peter Minarik (86,040 points)
selected Nov 25, 2020 by Superman365
 
Best answer

Characters have their character codes.

The type to store a character is "char" in C/C++ (and many other languages). To get the next character, you can just increment it.

E.g.:

for (char ch = 'A'; ch <= 'Z'; ch++)
{
    printf("%c\n", ch);
}
commented Nov 25, 2020 by Superman365 (560 points)
Thanks, I got a correct answer so this is the code: #include<stdio.h>
int main()
{
    for (char ch = 'A'; ch <= 'Z'; ch++)
    {
        printf("%c\n", ch);
    }
}
commented Nov 25, 2020 by Superman365 (560 points)
The Program worked!
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...