#2004
ore
Se consideră două evenimente a căror durată este exprimată fiecare prin câte trei numere naturale: ore (h
), minute (m
) şi secunde (s
). Să se scrie în fișierul de ieșire: a) pe primele două linii, duratele în formatul h: m: s
; b) pe următoarele două linii, duratele exprimate în secunde, corespunzătoare fiecărui eveniment, pe rânduri separate; c) pe următoarea linie suma obţinută din adunarea duratelor celor două evenimente, exprimată în ore, minute, secunde, în formatul h: m: s
.
Subiecte Atestat Informatica - Bucuresti
Problema | ore | Operații I/O |
ore.in /ore.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #54174623 | Utilizator | |
Fișier | ore.cpp | Dimensiune | 618 B |
Data încărcării | 21 Noiembrie 2024, 12:15 | Scor / rezultat | Eroare de compilare |
ore.cpp:4:1: error: 'iftream' does not name a type iftream cin("ore.in"); ^ ore.cpp:10:1: error: expected ';' after struct definition } int l1,l2,l; ^ ore.cpp: In function 'int main()': ore.cpp:13:13: error: request for member 'h' in 'l1', which is of non-class type 'int' cin>>l1.h>>l1.m>>l1.s; ^ ore.cpp:13:19: error: request for member 'm' in 'l1', which is of non-class type 'int' cin>>l1.h>>l1.m>>l1.s; ^ ore.cpp:13:25: error: request for member 's' in 'l1', which is of non-class type 'int' cin>>l1.h>>l1.m>>l1.s; ^ ore.cpp:14:13: error: request for member 'h' in 'l2', which is of non-class type 'int' cin>>l2.h>>l2.m>>l2.s; ^ ore.cpp:14:19: error: request for member 'm' in 'l2', which is of non-class type 'int' cin>>l2.h>>l2.m>>l2.s; ^ ore.cpp:14:25: error: request for member 's' in 'l2', which is of non-class type 'int' cin>>l2.h>>l2.m>>l2.s; ^ ore.cpp:16:1: error: reference to 'cout' is ambiguous cout<<l1.h<<": "<<l1.m<<": "<<l1.s<<endl; ^ ore.cpp:5:10: note: candidates are: std::ofstream cout ofstream cout("ore.out"); ^ In file included from ore.cpp:1:0: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^ ore.cpp:16:10: error: request for member 'h' in 'l1', which is of non-class type 'int' cout<<l1.h<<": "<<l1.m<<": "<<l1.s<<endl; ^ ore.cpp:16:22: error: request for member 'm' in 'l1', which is of non-class type 'int' cout<<l1.h<<": "<<l1.m<<": "<<l1.s<<endl; ^ ore.cpp:16:34: error: request for member 's' in 'l1', which is of non-class type 'int' cout<<l1.h<<": "<<l1.m<<": "<<l1.s<<endl; ^ ore.cpp:17:1: error: reference to 'cout' is ambiguous cout<<l2.h<<": "<<l2.m<<": "<<l2.s<<endl; ^ ore.cpp:5:10: note: candidates are: std::ofstream cout ofstream cout("ore.out"); ^ In file included from ore.cpp:1:0: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^ ore.cpp:17:10: error: request for member 'h' in 'l2', which is of non-class type 'int' cout<<l2.h<<": "<<l2.m<<": "<<l2.s<<endl; ^ ore.cpp:17:22: error: request for member 'm' in 'l2', which is of non-class type 'int' cout<<l2.h<<": "<<l2.m<<": "<<l2.s<<endl; ^ ore.cpp:17:34: error: request for member 's' in 'l2', which is of non-class type 'int' cout<<l2.h<<": "<<l2.m<<": "<<l2.s<<endl; ^ ore.cpp:18:7: error: request for member 'h' in 'l1', which is of non-class type 'int' r1=l1.h*3600+l1.m*60+l1.s; ^ ore.cpp:18:17: error: request for member 'm' in 'l1', which is of non-class type 'int' r1=l1.h*3600+l1.m*60+l1.s; ^ ore.cpp:18:25: error: request for member 's' in 'l1', which is of non-class type 'int' r1=l1.h*3600+l1.m*60+l1.s; ^ ore.cpp:19:7: error: request for member 'h' in 'l2', which is of non-class type 'int' r2=l2.h*3600+l2.m*60+l2.s; ^ ore.cpp:19:17: error: request for member 'm' in 'l2', which is of non-class type 'int' r2=l2.h*3600+l2.m*60+l2.s; ^ ore.cpp:19:25: error: request for member 's' in 'l2', which is of non-class type 'int' r2=l2.h*3600+l2.m*60+l2.s; ^ ore.cpp:20:1: error: reference to 'cout' is ambiguous cout<<r1<<endl<<r2<<endl; ^ ore.cpp:5:10: note: candidates are: std::ofstream cout ofstream cout("ore.out"); ^ In file included from ore.cpp:1:0: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^ ore.cpp:21:3: error: request for member 's' in 'l', which is of non-class type 'int' l.s=l1.s+l2.s; ^ ore.cpp:21:8: error: request for member 's' in 'l1', which is of non-class type 'int' l.s=l1.s+l2.s; ^ ore.cpp:21:13: error: request for member 's' in 'l2', which is of non-class type 'int' l.s=l1.s+l2.s; ^ ore.cpp:22:3: error: request for member 'm' in 'l', which is of non-class type 'int' l.m=l1.m+l2.m; ^ ore.cpp:22:8: error: request for member 'm' in 'l1', which is of non-class type 'int' l.m=l1.m+l2.m; ^ ore.cpp:22:13: error: request for member 'm' in 'l2', which is of non-class type 'int' l.m=l1.m+l2.m; ^ ore.cpp:23:3: error: request for member 'h' in 'l', which is of non-class type 'int' l.h=l1.h+l2.h; ^ ore.cpp:23:8: error: request for member 'h' in 'l1', which is of non-class type 'int' l.h=l1.h+l2.h; ^ ore.cpp:23:13: error: request for member 'h' in 'l2', which is of non-class type 'int' l.h=l1.h+l2.h; ^ ore.cpp:24:6: error: request for member 's' in 'l', which is of non-class type 'int' if(l.s>60) ^ ore.cpp:26:7: error: request for member 's' in 'l', which is of non-class type 'int' l.s=l.s-60; ^ ore.cpp:26:11: error: request for member 's' in 'l', which is of non-class type 'int' l.s=l.s-60; ^ ore.cpp:27:7: error: request for member 'm' in 'l', which is of non-class type 'int' l.m=l.m+1; ^ ore.cpp:27:11: error: request for member 'm' in 'l', which is of non-class type 'int' l.m=l.m+1; ^ ore.cpp:29:6: error: request for member 'm' in 'l', which is of non-class type 'int' if(l.m>60) ^ ore.cpp:30:8: error: request for member 'm' in 'l', which is of non-class type 'int' { l.m=l.m-60; ^ ore.cpp:30:12: error: request for member 'm' in 'l', which is of non-class type 'int' { l.m=l.m-60; ^ ore.cpp:31:3: error: request for member 'h' in 'l', which is of non-class type 'int' l.h=l.h+1; ^ ore.cpp:31:7: error: request for member 'h' in 'l', which is of non-class type 'int' l.h=l.h+1; ^ ore.cpp:33:1: error: reference to 'cout' is ambiguous cout<<l.h<<": "<<l.m<<": "<<l.s; ^ ore.cpp:5:10: note: candidates are: std::ofstream cout ofstream cout("ore.out"); ^ In file included from ore.cpp:1:0: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^ ore.cpp:33:9: error: request for member 'h' in 'l', which is of non-class type 'int' cout<<l.h<<": "<<l.m<<": "<<l.s; ^ ore.cpp:33:20: error: request for member 'm' in 'l', which is of non-class type 'int' cout<<l.h<<": "<<l.m<<": "<<l.s; ^ ore.cpp:33:31: error: request for member 's' in 'l', which is of non-class type 'int' cout<<l.h<<": "<<l.m<<": "<<l.s; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema ore 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ă.