codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
/* Arreglo de arreglos (cadenas de texto). Manejo. En funciones como parĂ¡metros */ // #include <iostream> using namespace std; int tamanio(const char *[]); void mostrar(const char *[]); void msgPausado(const char []); int main() { const char *palabra[] = {"hello", "good", "bye", "thing", "thanks", "roll", "over", "subway", "ceil", "floor", "adventure", "always", "anything", "bother", "brother", "sister", "mother", "father", "love", "beautiful", "scramble", "history", "argument", "library", "flower", "student", "teacher", "another", "decision", ""}; srand(time(0)); cout << "There are " << tamanio(palabra) << " words:\n\n"; mostrar(palabra); msgPausado("\n\nPulse <ENTER> para continuar ..."); system("cls"); int t = rand()%tamanio(palabra); msgPausado(palabra[t]); } int tamanio(const char *array[]) { int i = 0; while(strcmp(array[i], "")) i++; return i; } void mostrar(const char *array[]) { int i = 0; while(strcmp(array[i], "")) if (strlen(array[i])>7) cout << array[i++] << ((i-4)%4 ? "\t" : "\n"); else cout << array[i++] << ((i-4)%4 ? "\t\t" : "\n"); } void msgPausado(const char mensaje[]) { cout << mensaje; cin.get(); }
Private
[
?
]
Run code
Submit