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:
- 26:e7705b4a36bf
- Parent:
- 25:c4eed8baa6d3
- Child:
- 27:f49a13e3c1b3
diff -r c4eed8baa6d3 -r e7705b4a36bf main.cpp
--- a/main.cpp Thu Apr 02 00:31:09 2020 +0000
+++ b/main.cpp Sat Apr 11 20:47:59 2020 +0000
@@ -1,24 +1,31 @@
-#include "mbed.h" //libreria que nos permite utilizar comandos y sentencias propias de mbed
-
-//programa que genera una función sin argumentos y sin retorno de valor
+#include "mbed.h"
+#include <iostream>
+#include <stdlib.h>
+#include <time.h>
+
Serial com1(USBTX, USBRX);
-
- void mensaje(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
-
-
+ void Matriz(void)
+{
+ cout<<endl;
+ cout<<"Matriz aleatoria 0-255"<<endl;
+ cout<<"**********************************************"<<endl;
+ srand(time(NULL ));
+ int matriz [10][10];
+
+ for (int fila = 0; fila < 10; fila++)
+ {
+ for (int columna = 0; columna < 10; columna++)
+ {
+ matriz[fila][columna] = 1 + rand() % 256;
+ cout<<matriz[fila][columna]<<" ";
+ }
+ cout<<endl;
+ }
+ cout<<"**********************************************"<<endl;
+}
int main()
{
- mensaje();
-
+
+ Matriz();
}
-
-void mensaje(void)
-{ while(1)
- {
- com1.printf("Hola mundo \n");
- wait(1);
- }
-}
\ No newline at end of file