#1494
s_p_c
Scrieţi un program care citeşte din fişierul de intrare şiruri de caractere de forma cuvânt#tip
, unde cuvânt
este un şir oarecare de litere iar tip
poate fi una din literele S
, P
sau C
, semnificaţia fiind subiect, predicat sau complement. Programul va afişa, în ordine lexicografică, toate propoziţiile având structura subiect predicat complement ce pot fi formate cu ajutorul cuvintelor citite. Datele de intrare se consideră a fi corecte.
Problema | s_p_c | Operații I/O |
s_p_c.in /s_p_c.out
|
---|---|---|---|
Limita timp | 0.2 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #53687542 | Utilizator | |
Fișier | s_p_c.cpp | Dimensiune | 1.42 KB |
Data încărcării | 08 Noiembrie 2024, 13:15 | Scor / rezultat | Eroare de compilare |
s_p_c.cpp: In function 'int main()': s_p_c.cpp:16:12: error: reference to 'cin' is ambiguous while (cin >> c) ^ s_p_c.cpp:5:10: note: candidates are: std::ifstream cin ifstream cin("s_p_c.in"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from s_p_c.cpp:1: /usr/include/c++/4.8/iostream:60:18: note: std::istream std::cin extern istream cin; /// Linked to standard input ^ s_p_c.cpp:19:21: warning: comparison with string literal results in unspecified behaviour [-Waddress] if (c[i] == "#") ^ s_p_c.cpp:19:21: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] s_p_c.cpp:21:21: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] if (c[i] == S) ^ s_p_c.cpp:27:26: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] else if (c[i] == P) ^ s_p_c.cpp:33:26: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] else if (c[i] == C) ^ s_p_c.cpp:44:27: error: invalid conversion from 'char' to 'const char*' [-fpermissive] if (strcmp(S[i], S[j]) > 0) ^ In file included from /usr/include/c++/4.8/cstring:42:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:48, from s_p_c.cpp:1: /usr/include/string.h:144:12: error: initializing argument 1 of 'int strcmp(const char*, const char*)' [-fpermissive] extern int strcmp (const char *__s1, const char *__s2) ^ s_p_c.cpp:44:33: error: invalid conversion from 'char' to 'const char*' [-fpermissive] if (strcmp(S[i], S[j]) > 0) ^ In file included from /usr/include/c++/4.8/cstring:42:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:48, from s_p_c.cpp:1: /usr/include/string.h:144:12: error: initializing argument 2 of 'int strcmp(const char*, const char*)' [-fpermissive] extern int strcmp (const char *__s1, const char *__s2) ^ s_p_c.cpp:45:23: error: 's' was not declared in this scope swap (s[i], s[j]); ^ s_p_c.cpp:52:26: error: invalid conversion from 'char' to 'const char*' [-fpermissive] if(strcmp(P[i], P[j]) > 0) ^ In file included from /usr/include/c++/4.8/cstring:42:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:48, from s_p_c.cpp:1: /usr/include/string.h:144:12: error: initializing argument 1 of 'int strcmp(const char*, const char*)' [-fpermissive] extern int strcmp (const char *__s1, const char *__s2) ^ s_p_c.cpp:52:32: error: invalid conversion from 'char' to 'const char*' [-fpermissive] if(strcmp(P[i], P[j]) > 0) ^ In file included from /usr/include/c++/4.8/cstring:42:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:48, from s_p_c.cpp:1: /usr/include/string.h:144:12: error: initializing argument 2 of 'int strcmp(const char*, const char*)' [-fpermissive] extern int strcmp (const char *__s1, const char *__s2) ^ s_p_c.cpp:60:26: error: invalid conversion from 'char' to 'const char*' [-fpermissive] if(strcmp(C[i], C[j]) > 0) ^ In file included from /usr/include/c++/4.8/cstring:42:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:48, from s_p_c.cpp:1: /usr/include/string.h:144:12: error: initializing argument 1 of 'int strcmp(const char*, const char*)' [-fpermissive] extern int strcmp (const char *__s1, const char *__s2) ^ s_p_c.cpp:60:32: error: invalid conversion from 'char' to 'const char*' [-fpermissive] if(strcmp(C[i], C[j]) > 0) ^ In file included from /usr/include/c++/4.8/cstring:42:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:48, from s_p_c.cpp:1: /usr/include/string.h:144:12: error: initializing argument 2 of 'int strcmp(const char*, const char*)' [-fpermissive] extern int strcmp (const char *__s1, const char *__s2) ^ s_p_c.cpp:69:17: error: reference to 'cout' is ambiguous cout << S[i] << " " << P[j] << " " << C[k] << "\n"; ^ s_p_c.cpp:6:10: note: candidates are: std::ofstream cout ofstream cout ("s_p_c.out"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from s_p_c.cpp:1: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema s_p_c 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ă.