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: #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 ); }
|
|
DejaVu |
» 2009-04-23 19:02:27 Zamień int na double. |
|
mms1994 Temat założony przez niniejszego użytkownika |
» 2009-04-24 10:26:42 #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?? |
|
WunM |
» 2009-04-24 10:29:27 Zamiast kropek używasz przecinków, np: costam = 2, 5;
costam = 2.5;
|
|
mms1994 Temat założony przez niniejszego użytkownika |
» 2009-04-24 11:07:10 #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... |
|
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. |
|
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??? |
|
krdk |
» 2009-04-24 13:33:44 Zamienić. Popatrz do książki z 5 klasy podstawówki. |
|
« 1 » 2 |