scanf, descripcion y ejemplo

Dependencies:   mbed

Committer:
sherckuith
Date:
Tue Apr 03 21:03:42 2012 +0000
Revision:
0:21bcb4522e4e
scanf, descripcion y ejemplo

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sherckuith 0:21bcb4522e4e 1 #include "mbed.h"
sherckuith 0:21bcb4522e4e 2 /* scanf example */
sherckuith 0:21bcb4522e4e 3 #include <stdio.h>
sherckuith 0:21bcb4522e4e 4
sherckuith 0:21bcb4522e4e 5 int main ()
sherckuith 0:21bcb4522e4e 6 {
sherckuith 0:21bcb4522e4e 7 char str [80];
sherckuith 0:21bcb4522e4e 8 int i;
sherckuith 0:21bcb4522e4e 9
sherckuith 0:21bcb4522e4e 10 printf ("Enter your family name: ");
sherckuith 0:21bcb4522e4e 11 scanf ("%s",str);
sherckuith 0:21bcb4522e4e 12 printf ("Enter your age: ");
sherckuith 0:21bcb4522e4e 13 scanf ("%d",&i);
sherckuith 0:21bcb4522e4e 14 printf ("Mr. %s , %d years old.\n",str,i);
sherckuith 0:21bcb4522e4e 15 printf ("Enter a hexadecimal number: ");
sherckuith 0:21bcb4522e4e 16 scanf ("%x",&i);
sherckuith 0:21bcb4522e4e 17 printf ("You have entered %#x (%d).\n",i,i);
sherckuith 0:21bcb4522e4e 18
sherckuith 0:21bcb4522e4e 19 return 0;
sherckuith 0:21bcb4522e4e 20 }
sherckuith 0:21bcb4522e4e 21