.


:




:

































 

 

 

 


/




/ , , ++.

: / .

#include <sdtio.h>

int main () {

const int n = 20;

char s[n];

printf ( \n);

scanf (%s, s);

printf (\n \n)

printf (%s, s);

return 0;

}

scanf printf %s (). . , % () , :

scanf (%50c, s);

.

%s , :

printf (%50s, s);

. , , .

, / ( stdio.h).

int getchar(void);

int . , EOF.

EOF , , ( stdio.h).

char *gets(char *s);

s ( ). s.

int putchar (int ch);

ch . , ch, EOF.

int puts(char *s);

S , . EOF .

 

getwchar putwcchar.

, int wint_t. ( wctype.h).

, getwchar , getchar, :

wint_t getwchar(void);

: / .

#include <sdtio.h>

int main () {

const int n = 50;

char s[n];

printf ( \n);

gets (s);

printf (\n \n)

puts (s);

return 0;

}

scanf printf , . , puts gets.

: / ++.

#include <iostream.h>

int main () {

const int n = 20;

char s[n];

cout << : ;

cin >> s;

cout << endl << : << s;

return 0;

}

. , .

:

#include <iostream.h>

int main () {

const int n = 20;

char s[n], t[n], r[n];

cout << : ;

cin >> s >> t >> r;

cout << endl << : << s << << t << << r;

return 0;

}

, getline get istream, cin ( ).

:

#include <iostream.h>

int main () {

const int n = 50;

char s[n];

cout << : ;

cin.getline(s,n);

cout << endl << : << s << endl;

cout << : ;

cin.get(s,n);

cout << endl << : << s;

return 0;

}

getline n 1 ( \n ) s. , -. n 1, , .

get , -.

get \n :

in.get(s,n); // 1 1-

cout << s << endl; // 2 1-

in.get(s,n); // 3 2-

cout << s << endl; // 4 2-

, .. , get , .

, \n , get :

in.get(s,n); // 1 1-

cin.get(); // 2

cout << s << endl; // 3 1-

in.get(s,n); // 4 2-

cout << s << endl; // 5 2-

getline, \n .

, getline :

#include <iostream.h>

int main () {

const int n = 50;

char s[n];

while (cin.getline(s,n)) { /* */}

return 0;

}

: / ++.

#include <iostream.h>

int main (){

char ,d;

cout << :

cin >> >> d;

cout << endl << : << << d;

return 0;

}

, . get() get(c):

#include <iostream.h>

int main (){

char ,d;

cout << :

= cin.get(); cin.get(d);

cout << endl << : << << d;

return 0;

}

get() EOF, getc() , , .

: / ( ) .

#include <stdio.h>

int main (){

char ;

printf( : );

= getchar();

printf(\n : );

putchar ();

return 0;

}





:


: 2016-11-12; !; : 764 |


:

:

. .
==> ...

1440 - | 1407 -


© 2015-2024 lektsii.org - -

: 0.018 .