Wednesday, October 20, 2010

#3 Switch Operator višestrukog grananja opisne ocene

#include<stdio.h>
#include<conio.h>
 main()
{
       int ocena;
    printf("---------------------------- Operatori visestrukog grananja SWITCH ------------------------------------------------\n\n");
    printf("Switch operator zamenjuje visestruki if \n\n");
    printf("Program za prikazivanje celih skolskih ocena opisno (1:nedovoljan, 2:dovoljan, 3:dobar, 4:vrlodobar, 5:odlican) \n\n");
    printf("Unesite vasu prosecnu ocenu kao ceo broj npr. 2.5=3 4,2=4 ... \n");
    printf("ocena="); scanf("%d",&ocena);
   
    switch (ocena){
           case 1:
                {
                 printf("\n Nedovoljan");
                 break;                     
                }
           case 2:
                 {
                 printf("\n Dovoljan");
                 break;                     
                }
            case 3:
                 {
                 printf("\n Dobar");
                 break;                     
                }
             case 4:
                 {
                 printf("\n Vrlodobar");
                 break;                     
                }
              case 5:
                 {
                 printf("\n Odlican");
                 break;                     
                }
              default:
                {
                printf("\n Uneli ste nedefinisanu ocenu u mom sistemu");     
                break;
                }   
              }
              getch();
     }

No comments:

Post a Comment