#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 | #53687415 | Utilizator | |
Fișier | s_p_c.cpp | Dimensiune | 1.44 KB |
Data încărcării | 08 Noiembrie 2024, 13:10 | Scor / rezultat | Eroare de compilare |
s_p_c.cpp: In function 'int main()': 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:25: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] if (c[i + 1] == S) ^ s_p_c.cpp:27:30: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] else if (c[i + 1] == P) ^ s_p_c.cpp:33:30: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] else if (c[i + 1] == C) ^ s_p_c.cpp:44:27: error: invalid conversion from 'int' 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 'int' 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 'int' 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 'int' 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 'int' 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 'int' 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) ^
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ă.