Angel David Yaguana Hernandez
/
CPP_div
div, descripcion y ejemplo
main.cpp@0:7f41d307b1cb, 2012-04-03 (annotated)
- Committer:
- sherckuith
- Date:
- Tue Apr 03 21:00:47 2012 +0000
- Revision:
- 0:7f41d307b1cb
descripcion de division y ejemplo
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sherckuith | 0:7f41d307b1cb | 1 | #include "mbed.h" |
sherckuith | 0:7f41d307b1cb | 2 | |
sherckuith | 0:7f41d307b1cb | 3 | /* system example : DIR */ |
sherckuith | 0:7f41d307b1cb | 4 | #include <stdio.h> |
sherckuith | 0:7f41d307b1cb | 5 | #include <stdlib.h> |
sherckuith | 0:7f41d307b1cb | 6 | |
sherckuith | 0:7f41d307b1cb | 7 | int main () |
sherckuith | 0:7f41d307b1cb | 8 | { |
sherckuith | 0:7f41d307b1cb | 9 | int i; |
sherckuith | 0:7f41d307b1cb | 10 | printf ("Checking if processor is available..."); |
sherckuith | 0:7f41d307b1cb | 11 | if (system(NULL)) puts ("Ok"); |
sherckuith | 0:7f41d307b1cb | 12 | else exit (1); |
sherckuith | 0:7f41d307b1cb | 13 | printf ("Executing command DIR...\n"); |
sherckuith | 0:7f41d307b1cb | 14 | i=system ("dir"); |
sherckuith | 0:7f41d307b1cb | 15 | printf ("The value returned was: %d.\n",i); |
sherckuith | 0:7f41d307b1cb | 16 | return 0; |
sherckuith | 0:7f41d307b1cb | 17 | } |
sherckuith | 0:7f41d307b1cb | 18 | |
sherckuith | 0:7f41d307b1cb | 19 | |
sherckuith | 0:7f41d307b1cb | 20 | |
sherckuith | 0:7f41d307b1cb | 21 | //Output: |
sherckuith | 0:7f41d307b1cb | 22 | //38 div 5 => 7, remainder 3. |