#1812
LitereGen1
Scrieți un program care citeşte o valoare naturală impară pentru n
şi apoi generează şi afişează în ordine crescătoare lexicografic toate combinaţiile formate din n
litere mici care îndeplinesc următoarele proprietăţi:
- încep şi se termină cu a
;
- oricare două litere alăturate dintr-o combinaţie sunt consecutive în alfabet.
Problema | LitereGen1 | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 0.4 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #11734001 | Utilizator | |
Fișier | literegen1.cpp | Dimensiune | 1.36 KB |
Data încărcării | 08 Noiembrie 2018, 08:08 | Scor / rezultat | Eroare de compilare |
literegen1.cpp: In function 'void retin()': literegen1.cpp:32:12: error: invalid types 'char[int]' for array subscript a[nr][0]='a',a[nr][1]='b'; ^ literegen1.cpp:32:25: error: invalid types 'char[int]' for array subscript a[nr][0]='a',a[nr][1]='b'; ^ literegen1.cpp:33:38: error: invalid types 'char[int]' for array subscript for(int i=1; i<=p; i++) a[nr][i+1]='a'+x[i]-1; ^ literegen1.cpp:34:14: error: invalid types 'char[int]' for array subscript a[nr][p+2]='b',a[nr][p+3]='a'; ^ literegen1.cpp:34:29: error: invalid types 'char[int]' for array subscript a[nr][p+2]='b',a[nr][p+3]='a'; ^ literegen1.cpp:35:14: error: invalid types 'char[int]' for array subscript a[nr][p+4]='\0'; ^ literegen1.cpp: In function 'int main()': literegen1.cpp:66:30: error: invalid conversion from 'char' to 'const char*' [-fpermissive] if(strcmp(a[i],a[j])==1) ^ In file included from /usr/include/c++/4.8/cstring:42:0, from literegen1.cpp:3: /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) ^ literegen1.cpp:66:35: error: invalid conversion from 'char' to 'const char*' [-fpermissive] if(strcmp(a[i],a[j])==1) ^ In file included from /usr/include/c++/4.8/cstring:42:0, from literegen1.cpp:3: /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) ^ literegen1.cpp:67:31: error: invalid conversion from 'char' to 'const char*' [-fpermissive] strcpy(aux,a[i]),strcpy(a[i],a[j]),strcpy(a[j],aux); ^ In file included from /usr/include/features.h:374:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/os_defines.h:39, from /usr/include/i386-linux-gnu/c++/4.8/bits/c++config.h:426, from /usr/include/c++/4.8/iostream:38, from literegen1.cpp:1: /usr/include/i386-linux-gnu/bits/string3.h:102:1: error: initializing argument 2 of 'char* strcpy(char*, const char*)' [-fpermissive] __NTH (strcpy (char *__restrict __dest, const char *__restrict __src)) ^ literegen1.cpp:67:44: error: invalid conversion from 'char' to 'char*' [-fpermissive] strcpy(aux,a[i]),strcpy(a[i],a[j]),strcpy(a[j],aux); ^ In file included from /usr/include/features.h:374:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/os_defines.h:39, from /usr/include/i386-linux-gnu/c++/4.8/bits/c++config.h:426, from /usr/include/c++/4.8/iostream:38, from literegen1.cpp:1: /usr/include/i386-linux-gnu/bits/string3.h:102:1: error: initializing argument 1 of 'char* strcpy(char*, const char*)' [-fpermissive] __NTH (strcpy (char *__restrict __dest, const char *__restrict __src)) ^ literegen1.cpp:67:49: error: invalid conversion from 'char' to 'const char*' [-fpermissive] strcpy(aux,a[i]),strcpy(a[i],a[j]),strcpy(a[j],aux); ^ In file included from /usr/include/features.h:374:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/os_defines.h:39, from /usr/include/i386-linux-gnu/c++/4.8/bits/c++config.h:426, from /usr/include/c++/4.8/iostream:38, from literegen1.cpp:1: /usr/include/i386-linux-gnu/bits/string3.h:102:1: error: initializing argument 2 of 'char* strcpy(char*, const char*)' [-fpermissive] __NTH (strcpy (char *__restrict __dest, const char *__restrict __src)) ^ literegen1.cpp:67:62: error: invalid conversion from 'char' to 'char*' [-fpermissive] strcpy(aux,a[i]),strcpy(a[i],a[j]),strcpy(a[j],aux); ^ In file included from /usr/include/features.h:374:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/os_defines.h:39, from /usr/include/i386-linux-gnu/c++/4.8/bits/c++config.h:426, from /usr/include/c++/4.8/iostream:38, from literegen1.cpp:1: /usr/include/i386-linux-gnu/bits/string3.h:102:1: error: initializing argument 1 of 'char* strcpy(char*, const char*)' [-fpermissive] __NTH (strcpy (char *__restrict __dest, const char *__restrict __src)) ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema LitereGen1 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ă.