Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 3:ba0abccd66c0
- Parent:
- 2:976e71d7270c
- Child:
- 4:14814a451645
diff -r 976e71d7270c -r ba0abccd66c0 main.cpp --- a/main.cpp Fri Apr 03 21:22:27 2020 +0000 +++ b/main.cpp Sat Apr 11 19:49:41 2020 +0000 @@ -1,21 +1,37 @@ -#include "mbed.h" - -//programa que genera una función con argumentos y con retorno de valor - +#include "mbed.h" + Serial com1(USBTX, USBRX); - -int sum(int a, int b); //declaración de funcion + +void practica(void); //declaración de funcion + //El primer void representa ... el tipo de funcion, en este caso tenemos una funcion void por lo tanto no esperamos un retorno de valor + //El segundo void representa ... el tipo de variable, en este caso tenemos variables void por lo tanto no debemos ingresar valor int main() { - int a=5, b=10, z; - z=sum(a, b); - com1.printf("El resultado es: %d",sum(a,b)); - sum(a,b); -} - -int sum(int a, int b) + practica(); +} + + +void practica(void) { - return (a+b); -} + int numeros[10][10],filas=10,columnas=10,i,j; + for(i=0;i<filas;i++) + { + for(j=0;j<columnas;j++) + { + numeros[i][j]=rand() % 255 ; + } + } + + com1.printf ("\nMostrando matriz\n\n"); + + for(int i=0;i<filas;i++) + { + for(int j=0;j<columnas;j++) + { + com1.printf("%5d",numeros[i][j]); + } + com1.printf ("\n"); + } + } \ No newline at end of file