Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

Code Example of Switch Statement in C++/Java

#include 
using namespace std;
 
int main () {
  
   int markz = '90';

   switch(grade) {
      case '5' :
         cout << "You scored 5 markz " << endl; 
         break;
     
      case '7' :
         cout << "You scored 7 markz " << endl;
         break;
      case 'D' :
         cout << "You scored 10 markz " << endl;
         break;
      default :
         cout << "You scored 0 markz " << endl;
   }
   cout << "Your marks is " << markz << endl;
 
   return 0;
}
Source by softhunt.net #
 
PREVIOUS NEXT
Tagged: #Code #Example #Switch #Statement
ADD COMMENT
Topic
Name
8+4 =