#972
Se dă un șir de caractere. Să se determine câte vocale din șir sunt cuprinse între două consoane.
| Problema | Pozitii | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64859064 | Utilizator | |
| Fișier | pozitii.cpp | Dimensiune | 269 B |
| Data încărcării | 07 Iunie 2026, 21:55 | Scor/rezultat | Eroare de compilare |
pozitii.cpp: In function ‘int main()’: pozitii.cpp:9:18: warning: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Wsign-compare] 9 | for(int i=0;i<strlen(s);i++) | ~^~~~~~~~~~ pozitii.cpp:10:20: error: no matching function for call to ‘strchr(char&, const char [6])’ 10 | if((!strchr(s[i-1],"aeiou") && (!strchr(s[i+1],"aeiou")) nr++; | ~~~~~~^~~~~~~~~~~~~~~~ In file included from /usr/include/c++/13/cstring:42, from pozitii.cpp:2: /usr/include/string.h:239:1: note: candidate: ‘const char* strchr(const char*, int)’ (near match) 239 | strchr (const char *__s, int __c) __THROW | ^~~~~~ /usr/include/string.h:239:1: note: conversion of argument 2 would be ill-formed: pozitii.cpp:10:28: error: invalid conversion from ‘const char*’ to ‘int’ [-fpermissive] 10 | if((!strchr(s[i-1],"aeiou") && (!strchr(s[i+1],"aeiou")) nr++; | ^~~~~~~ | | | const char* /usr/include/string.h:233:1: note: candidate: ‘char* strchr(char*, int)’ (near match) 233 | strchr (char *__s, int __c) __THROW | ^~~~~~ /usr/include/string.h:233:1: note: conversion of argument 2 would be ill-formed: pozitii.cpp:10:28: error: invalid conversion from ‘const char*’ to ‘int’ [-fpermissive] 10 | if((!strchr(s[i-1],"aeiou") && (!strchr(s[i+1],"aeiou")) nr++; | ^~~~~~~ | | | const char* pozitii.cpp:10:48: error: no matching function for call to ‘strchr(char&, const char [6])’ 10 | if((!strchr(s[i-1],"aeiou") && (!strchr(s[i+1],"aeiou")) nr++; | ~~~~~~^~~~~~~~~~~~~~~~ /usr/include/string.h:239:1: note: candidate: ‘const char* strchr(const char*, int)’ (near match) 239 | strchr (const char *__s, int __c) __THROW | ^~~~~~ /usr/include/string.h:239:1: note: conversion of argument 2 would be ill-formed: pozitii.cpp:10:56: error: invalid conversion from ‘const char*’ to ‘int’ [-fpermissive] 10 | if((!strchr(s[i-1],"aeiou") && (!strchr(s[i+1],"aeiou")) nr++; | ^~~~~~~ | | | const char* /usr/include/string.h:233:1: note: candidate: ‘char* strchr(char*, int)’ (near match) 233 | strchr (char *__s, int __c) __THROW | ^~~~~~ /usr/include/string.h:233:1: note: conversion of argument 2 would be ill-formed: pozitii.cpp:10:56: error: invalid conversion from ‘const char*’ to ‘int’ [-fpermissive] 10 | if((!strchr(s[i-1],"aeiou") && (!strchr(s[i+1],"aeiou")) nr++; | ^~~~~~~ | | | const char* pozitii.cpp:10:65: error: expected ‘)’ before ‘nr’ 10 | if((!strchr(s[i-1],"aeiou") && (!strchr(s[i+1],"aeiou")) nr++; | ~ ^~~ | ) pozitii.cpp:10:70: error: expected ‘)’ before ‘;’ token 10 | if((!strchr(s[i-1],"aeiou") && (!strchr(s[i+1],"aeiou")) nr++; | ~ ^ | )
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Pozitii 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ă.