C Tutorial/printf scanf/scanf unsigned — различия между версиями
Admin (обсуждение | вклад) м (1 версия: Импорт контента...) |
Admin (обсуждение | вклад) м (1 версия: Импорт контента...) |
(нет различий)
|
Текущая версия на 13:32, 25 мая 2010
o: Used for unsigned int expected"s value.
It should be an integer in octal form.
<source lang="cpp">#include <stdio.h>
main()
{
int i = 0; int k; printf("an integer:"); i=scanf("%o",&k); printf("total values inputted %d\n",i); printf("The input values %o\n",k);
}</source>
an integer:2 total values inputted 1 The input values 2
U: Unsigned integer in decimal form.
<source lang="cpp">#include <stdio.h> main() {
int i = 0; int k; printf("integer:"); i=scanf("%u",&k); printf("total values inputted %d\n",i); printf("The input values %u\n",k);
}</source>
integer:3 total values inputted 1 The input values 3
X: Unsigned integer in hexadecimal form.
<source lang="cpp">#include <stdio.h> main() {
int i = 0; int k; printf("integer:"); i=scanf("%X",&k); printf("total values inputted %d\n",i); printf("The input values %X\n",k);
}</source>
integer:2 total values inputted 1 The input values 2