I am creating a program which asks user for reply and how many time you want to print reply and display it. I have used a while loop and switch case in the program.
But when I store input in variable a with help of std::cin, the same input is not received by switch case. Any help is appreciated.
#include <iostream>
using namespace std;
int a;
int input;
int i=1;
void display()
{
    cout << "Select a choice for reply" << endl;
    cout << "1.Thank You" << endl;
    cout << "2.Welcome" << endl;
    cout << "3.Okay" << endl;
}
int main()
{
    display();
    cout << "Enter Choice" << endl;
    cin >> a;
    input='a';
    switch (input)
    {
        case '1': {
            int x;
            cout << "Enter no. of times  you want to print reply line" << endl;
            cin >> x;
            while (i <= x)
            {
                cout << "Thank you" << endl;
            }
            break;
        }
        case '2': {
            int x;
            cout << "Enter no. of times  you want to print line" << endl;
            cin >> x;
            while (i <= x)
            {
                cout << "Welcome" << endl;
            }
            break;
        }
        case '3': {
            int x;
            cout << "Enter no. of times  you want to print line" << endl;
            cin >> x;
            while (i <= x)
            {
                cout << "okay" << endl;
            }
            break;
        }
        default: {
            cout << "wrong choice" << endl;
        }
        cout << "Thank you for replying" << endl;
    }
    return 0;
}
 
     
     
     
     
    