Programming and algorithm (a)

the second week:

1, note the following points when cin input:

(1) The input cin, default skips spaces.

Such as:

int i; char c; float f;

cin >> i >> c >> f;

When the input 10 k 2.1, 10 does not exist after the space (c), but the presence of c, k.

Scanf input is used with a different, default is not to skip spaces:

int i; char c; float f;

scanf("%d%c%f", &i, &c, &f);

When the input 10 k 2.1, 10 will exist after the space (c), but the presence of c, k.

(2)

Guess you like

Origin www.cnblogs.com/trex-zxf-1988/p/12629144.html