If-Else to a Switch Statement


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: If-Else to a Switch Statement

  1. #1
    Join Date
    Oct 2003
    Posts
    2

    If-Else to a Switch Statement

    I'm trying to rewrite these If-Else Statements into a Switch statement. the problem is i have the >= in the If-Else and everywhere i look. the switch statement corresponds to ==.

    char G;
    if (N >= 90)
    G = 'A';
    else if (N>=80)
    G = 'B';
    else if (N>=70)
    G = 'C';
    else if (N>=60)
    G = 'D';
    else
    G = 'F';

  2. #2
    Join Date
    Mar 2003
    Posts
    834
    Can't be done - this is the situation where you use the if statement.
    ArchAngel.
    O:-)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center