#3269
ReverseWords
C++
Scrieți funcția având următorul antet:
void ReverseWords(char s[])
Funcția primește ca parametru un șir s
format din cuvinte separate prin câte un spațiu. Cuvintele sunt formate doar din litere mici. Funcția va returna, tot prin intermediul parametrului s
, cuvintele în ordine inversă, separate tot prin câte un spațiu.
Problemă de interviu
Problema | ReverseWords | Operații I/O |
reversewords.in /reversewords.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 1 MB
/
Stivă 1 MB
|
Id soluție | #24131383 | Utilizator | |
Fișier | reversewords.cpp | Dimensiune | 631 B |
Data încărcării | 28 Septembrie 2020, 14:15 | Scor / rezultat | Eroare de compilare |
reversewords.cpp: In function 'void Prescurtat(char*)': reversewords.cpp:13:20: error: 'strtok' was not declared in this scope p=strtok(s,sep); w[0]='\0'; ^ reversewords.cpp:19:18: error: 'strlen' was not declared in this scope n=strlen(p); ^ reversewords.cpp:21:35: error: 'strcat' was not declared in this scope if (p[n-1]!='.') strcat(w,p); ^ reversewords.cpp:29:27: error: 'strstr' was not declared in this scope if (strstr(c1,p)) strcat(w,c1); ^ reversewords.cpp:29:41: error: 'strcat' was not declared in this scope if (strstr(c1,p)) strcat(w,c1); ^ reversewords.cpp:31:27: error: 'strstr' was not declared in this scope if (strstr(c2,p)) strcat(w,c2); ^ reversewords.cpp:31:41: error: 'strcat' was not declared in this scope if (strstr(c2,p)) strcat(w,c2); ^ reversewords.cpp:33:27: error: 'strstr' was not declared in this scope if (strstr(c3,p)) strcat(w,c3); ^ reversewords.cpp:33:41: error: 'strcat' was not declared in this scope if (strstr(c3,p)) strcat(w,c3); ^ reversewords.cpp:35:27: error: 'strstr' was not declared in this scope if (strstr(c4,p)) strcat(w,c4); ^ reversewords.cpp:35:41: error: 'strcat' was not declared in this scope if (strstr(c4,p)) strcat(w,c4); ^ reversewords.cpp:41:28: error: 'strcat' was not declared in this scope if (p) strcat(w, " "); ^ reversewords.cpp:45:14: error: 'strcpy' was not declared in this scope strcpy(s,w); ^ reversewords.cpp: In function 'int main()': reversewords.cpp:55:19: error: 'ReverseWords' was not declared in this scope ReverseWords(s); ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema ReverseWords face parte din a doua categorie. Pentru aceste probleme se folosește un program suport, furnizat de propunătorul problemei. 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ă.