I dont know whats wrong with my code..
when i entered the value,there was nothing appeared on my screen..

I've tried put the single quote like this one :
case '1' :
cout<<Very Acidic;
break;

..but it was only works for the acidic value..When i entered the value more than 7,it will display the "very acidic" statement and not the value that it supposed to display..

Thank you :)

#include <iostream>
using namespace std;

int main () {
  char ph;
 
  cout<<"Enter the ph value";
  cin>>ph;
  cout<<endl;

  switch (ph) {
    
      case 1 :
         cout<<"Very Acidic";
         break;

      case 2 :
         cout<<"Acidic";
         break;

       case 3 :
          cout<<"Acidic";
          break;

       case 4 :
          cout<<"Acidic";
          break;

       case 5 :
          cout<<"Acidic";
          break;

        case 6 :
          cout<<"Acidic";
          break;

        case 7 :
          cout<<"neutral";
          break;

        case 8:
          cout<<"Alkaline";
          break;

        case 9:
         cout<<"Alkaline";
          break;

        case 10:
          cout<<"Alkaline";
          break;

        case 11:
          cout<<"Alkaline";
          break;

        case 12:
          cout<<"Alkaline";
          break;

        case 14:
          cout<<"Alkaline";
          break;

        default : cout<<"wrong input ";

cin.get()
}

Just change ph to an int (it doesn't work because 10-14 aren't chars, they are strings)

And you're missing a semicolon after cin.get() and you need to close your switch statement with a brace

owh..thank you...
now i got it :)
thanks...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.