#179
Să se scrie un program care citeşte trei numere reale şi verifică dacă aceste numere pot fi lungimile laturilor unui triunghi.
| Problema | triunghi | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64673345 | Utilizator | |
| Fișier | triunghi.cpp | Dimensiune | 355 B |
| Data încărcării | 21 Mai 2026, 19:27 | Scor/rezultat | Eroare de compilare |
triunghi.cpp: In function ‘int main()’: triunghi.cpp:7:8: warning: init-statement in selection statements only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions] 7 | if(x>0 && y>0 && z>0 && ((x+y>z)||(x+z>y)||(z+y>x)){ | ^ triunghi.cpp:7:56: error: expected ‘;’ before ‘{’ token 7 | if(x>0 && y>0 && z>0 && ((x+y>z)||(x+z>y)||(z+y>x)){ | ^ | ; triunghi.cpp:7:26: warning: statement has no effect [-Wunused-value] 7 | if(x>0 && y>0 && z>0 && ((x+y>z)||(x+z>y)||(z+y>x)){ | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ triunghi.cpp:13:9: error: expected primary-expression before ‘if’ 13 | if(x<=0 || y<=0 || z<=0 || ok==0) | ^~ triunghi.cpp:12:6: error: expected ‘)’ before ‘if’ 12 | } | ^ | ) 13 | if(x<=0 || y<=0 || z<=0 || ok==0) | ~~ triunghi.cpp:7:7: note: to match this ‘(’ 7 | if(x>0 && y>0 && z>0 && ((x+y>z)||(x+z>y)||(z+y>x)){ | ^ triunghi.cpp:5:15: warning: unused variable ‘ok’ [-Wunused-variable] 5 | int x,y,z,ok=0; | ^~
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema triunghi face parte din prima categorie. Soluția propusă de tine va fi evaluată astfel:
Suma punctajelor acordate pe testele utilizate pentru verificare este 100. Astfel, soluția ta poate obține cel mult 100 de puncte, caz în care se poate considera corectă.