vendredi 27 décembre 2019

I am trying to print some corresponding values to a character but condition always going to else

I am trying to print some values specified in if condition but compiler throws errors that this variable is not declared in this scope.

```

#include <bits/stdc++.h>
using namespace std;

int main()
{
  char i, p, P, z, Z, e, E, d, D;
  cin>>i;

  if(i==p || i==P)
    cout<<"PrepBytes";

  else if(i==z || i==Z)
    cout<<"Zenith";

  else if(i==e || i==E)
    cout<<"Expert Coder";

  else if(i==d || i==D)
    cout<<"Data Structure";

  else
    cout<<"Wrong Input";

  return 0;
}

Output:-

PS E:\C++> .\a.exe
d
Wrong Input

Aucun commentaire:

Enregistrer un commentaire