Ask Question
20 March, 09:21

How can I write an assignment statement that stores the character 'X' in a variable ch?

+4
Answers (1)
  1. 20 March, 10:55
    0
    In C+ + we can assign a character to the variable by using the below statement.

    ch='X';

    Explanation:

    The complete program for assigning a character to the variable is given as

    #include

    #include

    using namespace std;

    main ()

    {

    char ch;

    ch = 'X';

    cout<<"output of variable Ch = "<
    getch ();

    }

    In above program Char is the data type used for character type variables. ch = 'X' stores X in ch. Then output will shown through cout.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “How can I write an assignment statement that stores the character 'X' in a variable ch? ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers