Panel użytkownika
Nazwa użytkownika:
Hasło:
Nie masz jeszcze konta?

Oceny

Ostatnio zmodyfikowano 2009-05-02 13:58
Autor Wiadomość
mms1994
Temat założony przez niniejszego użytkownika
Oceny
» 2009-04-23 18:30:46
Witam!!
Co jest źle z tym programem, bo dev-c++ ciągle wyświetla 5, jakich by nie podać wartości:


C/C++
#include <conio.h>
#include <iostream>


int main()
{
    using namespace std;
    int a, b, c, d, e, punkty, full;
   
    cout << "Podaj maksymalna liczbe punktow: " << endl;
    cin >> full;
    cout << "Podaj liczbe punktow zdobytych przez ucznia: " << endl;
    cin >> punkty;
   
    c = b / a;
    c = punkty / full;
   
    if( c <= 0, 39 * full )
         if( c <= 0, 39 * full ) d = 1;
    else( c <= 0, 39 * full );
   
    if( 0, 4 * full <= c && c <= 0, 48 * full )
         if( 0, 4 * full <= c && c <= 0, 48 * full ) d = 2;
    else( 0, 4 * full <= c && c <= 0, 48 * full );
   
    if( 0, 49 * full <= c && c <= 0, 56 * full )
         if( 0, 49 * full <= c && c <= 0, 56 * full ) d = 2, 5;
    else( 0, 49 * full <= c && c <= 0, 56 * full );
   
    if( 0, 57 * full <= c && c <= 0, 64 * full )
         if( 0, 57 * full <= c && c <= 0, 64 * full ) d = 3;
    else( 0, 57 * full <= c && c <= 0, 64 * full );
   
    if( 0, 65 * full <= c && c <= 0, 72 * full )
         if( 0, 65 * full <= c && c <= 0, 72 * full ) d = 3, 5;
    else( 0, 65 * full <= c && c <= 0, 72 * full );
   
    if( 0, 73 * full <= c && c <= 0, 80 * full )
         if( 0, 73 * full <= c && c <= 0, 80 * full ) d = 4;
    else( 0, 73 * full <= c && c <= 0, 80 * full );
   
    if( 0, 81 * full <= c && c <= 0, 88 * full )
         if( 0, 81 * full <= c && c <= 0, 88 * full ) d = 4, 5;
    else( 0, 81 * full <= c && c <= 0, 88 * full );
   
    if( 0, 89 * full <= c && c <= 0, 96 * full )
         if( 0, 89 * full <= c && c <= 0, 96 * full ) d = 5;
    else( 0, 89 * full <= c && c <= 0, 96 * full );
   
    if( 0, 97 * full <= c && c <= full )
         if( 0, 97 * full <= c && c <= full ) d = 5, 5;
    else( 0, 97 * full <= c && c <= full );
   
    if( full < c )
         if( full < c ) d = 6;
   
   
    cout << "Ocena to: " << d << endl;
   
    getch();
    return( 0 );
}
P-5921
DejaVu
» 2009-04-23 19:02:27
Zamień int na double.
P-5923
mms1994
Temat założony przez niniejszego użytkownika
» 2009-04-24 10:26:42
C/C++
#include <conio.h>
#include <iostream>


int main()
{
    using namespace std;
    double a, b, c, d, e, punkty, full;
   
    cout << "Podaj maksymalna liczbe punktow: " << endl;
    cin >> full;
    cout << "Podaj liczbe punktow zdobytych przez ucznia: " << endl;
    cin >> punkty;
   
    c = b / a;
    c = punkty / full;
   
    if( c <= 0, 39 * full )
         if( c <= 0, 39 * full ) d = 1;
    else( c <= 0, 39 * full );
   
    if( 0, 4 * full <= c && c <= 0, 48 * full )
         if( 0, 4 * full <= c && c <= 0, 48 * full ) d = 2;
    else( 0, 4 * full <= c && c <= 0, 48 * full );
   
    if( 0, 49 * full <= c && c <= 0, 56 * full )
         if( 0, 49 * full <= c && c <= 0, 56 * full ) d = 2, 5;
    else( 0, 49 * full <= c && c <= 0, 56 * full );
   
    if( 0, 57 * full <= c && c <= 0, 64 * full )
         if( 0, 57 * full <= c && c <= 0, 64 * full ) d = 3;
    else( 0, 57 * full <= c && c <= 0, 64 * full );
   
    if( 0, 65 * full <= c && c <= 0, 72 * full )
         if( 0, 65 * full <= c && c <= 0, 72 * full ) d = 3, 5;
    else( 0, 65 * full <= c && c <= 0, 72 * full );
   
    if( 0, 73 * full <= c && c <= 0, 80 * full )
         if( 0, 73 * full <= c && c <= 0, 80 * full ) d = 4;
    else( 0, 73 * full <= c && c <= 0, 80 * full );
   
    if( 0, 81 * full <= c && c <= 0, 88 * full )
         if( 0, 81 * full <= c && c <= 0, 88 * full ) d = 4, 5;
    else( 0, 81 * full <= c && c <= 0, 88 * full );
   
    if( 0, 89 * full <= c && c <= 0, 96 * full )
         if( 0, 89 * full <= c && c <= 0, 96 * full ) d = 5;
    else( 0, 89 * full <= c && c <= 0, 96 * full );
   
    if( 0, 97 * full <= c && c <= full )
         if( 0, 97 * full <= c && c <= full ) d = 5, 5;
    else( 0, 97 * full <= c && c <= full );
   
    if( full < c )
         if( full < c ) d = 6;
   
   
    cout << "Ocena to: " << d << endl;
   
    getch();
    return( 0 );
}

A teraz co??
P-5928
WunM
» 2009-04-24 10:29:27
Zamiast kropek używasz przecinków, np:

C/C++
costam = 2, 5;
//zamień na:
costam = 2.5;
P-5929
mms1994
Temat założony przez niniejszego użytkownika
» 2009-04-24 11:07:10
C/C++
#include <conio.h>
#include <iostream>


int main()
{
    using namespace std;
    double a, b, c, d, e, punkty, full;
   
    cout << "Podaj maksymalna liczbe punktow: " << endl;
    cin >> full;
    cout << "Podaj liczbe punktow zdobytych przez ucznia: " << endl;
    cin >> punkty;
   
    c = b / a;
    c = punkty / full;
   
    if( c <= 0, 39 * full )
         if( c <= 0, 39 * full ) d = 1;
    else( c <= 0, 39 * full );
   
    if( 0, 4 * full <= c && c <= 0, 48 * full )
         if( 0, 4 * full <= c && c <= 0, 48 * full ) d = 2;
    else( 0, 4 * full <= c && c <= 0, 48 * full );
   
    if( 0, 49 * full <= c && c <= 0, 56 * full )
         if( 0, 49 * full <= c && c <= 0, 56 * full ) d = 2.5;
    else( 0, 49 * full <= c && c <= 0, 56 * full );
   
    if( 0, 57 * full <= c && c <= 0, 64 * full )
         if( 0, 57 * full <= c && c <= 0, 64 * full ) d = 3;
    else( 0, 57 * full <= c && c <= 0, 64 * full );
   
    if( 0, 65 * full <= c && c <= 0, 72 * full )
         if( 0, 65 * full <= c && c <= 0, 72 * full ) d = 3.5;
    else( 0, 65 * full <= c && c <= 0, 72 * full );
   
    if( 0, 73 * full <= c && c <= 0, 80 * full )
         if( 0, 73 * full <= c && c <= 0, 80 * full ) d = 4;
    else( 0, 73 * full <= c && c <= 0, 80 * full );
   
    if( 0, 81 * full <= c && c <= 0, 88 * full )
         if( 0, 81 * full <= c && c <= 0, 88 * full ) d = 4.5;
    else( 0, 81 * full <= c && c <= 0, 88 * full );
   
    if( 0, 89 * full <= c && c <= 0, 96 * full )
         if( 0, 89 * full <= c && c <= 0, 96 * full ) d = 5;
    else( 0, 89 * full <= c && c <= 0, 96 * full );
   
    if( 0, 97 * full <= c && c <= full )
         if( 0, 97 * full <= c && c <= full ) d = 5.5;
    else( 0, 97 * full <= c && c <= full );
   
    if( full < c )
         if( full < c ) d = 6;
   
   
    cout << "Ocena to: " << d << endl;
   
    getch();
    return( 0 );
}
Po poprawach, ten sam błąd...
P-5930
DejaVu
» 2009-04-24 11:15:10
0,97*full <= pełno takich błędów masz w kodzie - nie poprawiłeś wszystkich przecinków na kropki w liczbach.
P-5931
mms1994
Temat założony przez niniejszego użytkownika
» 2009-04-24 11:41:53
Już pousuwałem, tylko jak zrobić aby to były procenty???
P-5932
krdk
» 2009-04-24 13:33:44
Zamienić. Popatrz do książki z 5 klasy podstawówki.
P-5934
« 1 » 2
  Strona 1 z 2 Następna strona