Visualizzazione dei risultati da 1 a 5 su 5

Visualizzazione discussione

  1. #1

    Problema risultato espressione in C

    salve ragazze, il mio problema è che quando immetto code con il code i valori 2 o 3 o 4 (cosi ho nominato la variabile) e inserisco i dati richiesti, il terminale windows mi mostra come risultato 0.000000

    codice:
    #include<stdio.h>
    
    main()
    { float stipend, h_week, worker,  stipend3,  lord_sale, stipend4,  price_article; /* h_week sono le ore settimanali*/
     int code, num_art;
    
    
     stipend = 750;
    
    
    printf("Enter dipendent code\n")  ;
    printf("Enter teh EOF to end input");
    
    
    while((code=getchar()) !=EOF) {
    
    
        switch(code){
    
    
           case '1':
             printf("The manager stipend is:\n %d\n",  750);
             break;
    
    
           case  '2':
           printf("enter hours\n");
           scanf("%d", &h_week);
    
    
           if(h_week<=40)
    
    
              printf("Dipendent earn:\n %.2f\n", h_week*15 );
              else{ printf("Dipendent earn:\n %.2f", 40*7.50+((h_week-40)*7.50)*1.50); }
    
    
            break;
    
    
            case '3' :
            printf("Enter sales\n");
            scanf("%.2f", &lord_sale );
            stipend3=250+lord_sale*5.7;
            printf("The earn is\n .2f\n", stipend3);
            break;
    
    
            case '4' :
            printf("Enter # articles sale\n");
            scanf("%d", &num_art);
            printf("Enter price unit article");
            scanf("%.2f", &price_article );
            stipend4=num_art*price_article;
            printf("The earn is;\n .2f\n", stipend4);
            break;
    
    
            case '\n': case' ':
            break;
    
    
            default:
               printf("Incorrect letter code\n Enter a new code\n");
    
    
          }}
    
    
    return 0;}
    Ultima modifica di ARMANDO888; 16-01-2014 a 19:37

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.