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.
main.cpp@26:c1f837b137f8, 2020-04-12 (annotated)
- Committer:
- montse
- Date:
- Sun Apr 12 02:31:32 2020 +0000
- Revision:
- 26:c1f837b137f8
- Parent:
- 25:32acf45398b4
- Child:
- 27:8678c21abbeb
El objetivo de este programa es mediante el uso del condicional if permitir imprimir diferentes mensajes cuando se presionan al menos tres diferentes teclas.
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| montse | 25:32acf45398b4 | 1 | #include "mbed.h" //libreria que nos permite utilizar comandos y sentencias propias de mbed |
| montse | 25:32acf45398b4 | 2 | #include <iostream> |
| dan | 0:7dec7e9ac085 | 3 | |
| montse | 25:32acf45398b4 | 4 | //Mediante el uso del condicional if implementar un programa que permita imprimir diferentes mensajes cuando se presionan al menos tres diferentes teclas. |
| montse | 25:32acf45398b4 | 5 | |
| montse | 25:32acf45398b4 | 6 | Serial com1(USBTX, USBRX); |
| montse | 25:32acf45398b4 | 7 | |
| montse | 25:32acf45398b4 | 8 | using namespace std; |
| dan | 0:7dec7e9ac085 | 9 | |
| montse | 25:32acf45398b4 | 10 | int main() |
| montse | 25:32acf45398b4 | 11 | { |
| montse | 25:32acf45398b4 | 12 | int tecla; |
| montse | 25:32acf45398b4 | 13 | com1.printf("Cuantas veces al dia te lavas las manos? \n\n"); |
| montse | 25:32acf45398b4 | 14 | if ((tecla <= 9)&&(tecla >= 3)){ |
| montse | 25:32acf45398b4 | 15 | com1.printf("Eso es genial. \n"); |
| montse | 25:32acf45398b4 | 16 | |
| montse | 26:c1f837b137f8 | 17 | com1.printf("Ojala mas personas sean responsables como tu :) \n\n"); |
| dan | 0:7dec7e9ac085 | 18 | } |
| montse | 25:32acf45398b4 | 19 | |
| montse | 26:c1f837b137f8 | 20 | if ((tecla <3)&&(tecla >= 0)){ |
| montse | 25:32acf45398b4 | 21 | com1.printf("Eso es triste :( \n"); |
| montse | 25:32acf45398b4 | 22 | |
| montse | 25:32acf45398b4 | 23 | com1.printf("Hazlo mas seguido y no olvides usar gel antibacterial. \n\n"); |
| montse | 25:32acf45398b4 | 24 | } |
| montse | 25:32acf45398b4 | 25 | |
| montse | 25:32acf45398b4 | 26 | if (tecla >=10){ |
| montse | 25:32acf45398b4 | 27 | com1.printf("Vaya! Tu si que te cuidas. \n"); |
| montse | 25:32acf45398b4 | 28 | |
| montse | 25:32acf45398b4 | 29 | } |
| montse | 25:32acf45398b4 | 30 | |
| montse | 26:c1f837b137f8 | 31 | com1.printf("Recuerda: Si te cuidas tu, nos cuidamos todos."); |
| montse | 25:32acf45398b4 | 32 | } |
| montse | 25:32acf45398b4 | 33 |