#2715
ROT13
Laura vrea să vă scrie un șir de caractere pe care numai ea îl cunoaște. Realizează însă că, dacă l-ar scrie așa, pur și simplu, alte persoane ar putea să îl vadă și să îl înțeleagă, lucru care o îngrijorează. Astfel, fata află despre cum poate ascunde acest mesaj folosind codificarea în ROT13. (…)
-
Problema | ROT13 | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 1.75 secunde | Limita memorie |
Total: 0.2 MB
/
Stivă 0.1 MB
|
Id soluție | #54876096 | Utilizator | |
Fișier | rot13.cpp | Dimensiune | 504 B |
Data încărcării | 11 Decembrie 2024, 07:28 | Scor / rezultat | Eroare de compilare |
rot13.cpp: In function 'int main()': rot13.cpp:7:26: error: invalid conversion from 'unsigned char*' to 'std::basic_istream<char>::char_type* {aka char*}' [-fpermissive] cin.getline(a,1000003); ^ In file included from /usr/include/c++/4.8/iostream:40:0, from rot13.cpp:1: /usr/include/c++/4.8/istream:427:7: error: initializing argument 1 of 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::getline(std::basic_istream<_CharT, _Traits>::char_type*, std::streamsize) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>; std::basic_istream<_CharT, _Traits>::char_type = char; std::streamsize = int]' [-fpermissive] getline(char_type* __s, streamsize __n) ^ rot13.cpp:9:28: error: invalid conversion from 'unsigned char*' to 'const char*' [-fpermissive] for(int i=0; i<strlen(a); i++){ ^ In file included from /usr/include/c++/4.8/cstring:42:0, from rot13.cpp:2: /usr/include/string.h:399:15: error: initializing argument 1 of 'size_t strlen(const char*)' [-fpermissive] extern size_t strlen (const char *__s) ^ rot13.cpp:9:28: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int i=0; i<strlen(a); i++){ ^ rot13.cpp:10:14: warning: comparison with string literal results in unspecified behaviour [-Waddress] if(a[i]>="A" and a[i]<="Z"-13) ^ rot13.cpp:10:14: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] rot13.cpp:10:32: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] if(a[i]>="A" and a[i]<="Z"-13) ^ rot13.cpp:12:27: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] else if( a[i]>"Z"-13 and a[i]!=" ") ^ rot13.cpp:12:40: warning: comparison with string literal results in unspecified behaviour [-Waddress] else if( a[i]>"Z"-13 and a[i]!=" ") ^ rot13.cpp:12:40: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] rot13.cpp:13:28: error: invalid operands of types 'unsigned char' and 'const char [2]' to binary 'operator-' a[i]="A"+(a[i]-"Z"+1); ^ rot13.cpp:14:28: warning: comparison with string literal results in unspecified behaviour [-Waddress] else if( a[i]>="a" and a[i]<="z"-13) ^ rot13.cpp:14:28: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] rot13.cpp:14:46: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] else if( a[i]>="a" and a[i]<="z"-13) ^ rot13.cpp:16:30: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] else if(a[i]>"z"-13 and a[i]!=" ") ^ rot13.cpp:16:43: warning: comparison with string literal results in unspecified behaviour [-Waddress] else if(a[i]>"z"-13 and a[i]!=" ") ^ rot13.cpp:16:43: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] rot13.cpp:17:28: error: invalid operands of types 'unsigned char' and 'const char [2]' to binary 'operator-' a[i]="a"+(a[i]-"z"+1); ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema ROT13 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ă.