C++.


/


, , , char, int, string .. - get() istream

, getline() , , - , . - get() :

get(char& ch) ( ) ch. iostream, . , , :

#include <iostream>

 

int main()

{

char ch;

int tab_cnt = 0, nl_cnt = 0, space_cnt = 0,

period_cnt = 0, comma_cnt = 0;

while ( cin.get(ch)) {

switch( ch ) {

case ' ': space_cnt++; break;

case '\t': tab_cnt++; break;

case '\n': nl_cnt++; break;

case '.': period_cnt++; break;

case ',': comma_cnt++; break;

}

cout.put(ch);

}

 

cout << "\n :\n\t"

<< ": " << space_cnt << '\t'

<< " : " << nl_cnt << '\t'

<< ": " << tab_cnt << "\n\t"

<< ": " << period_cnt << '\t'

<< ": " << comma_cnt << endl;

}

- put()

ostream

: put()

char ostream, .

:

 

Alice Emma has long flowing red hair. Her Daddy says