字符串处理函数

1.

char c;
c=getchar();
putchar(c);

2.getline

#include <string>
#include <iostream>

using namespace std ;

int main()
{
   string s1;
   cout << "Enter a sentence (use <space> as the delimiter): ";
   getline(cin,s1, ' ');
   cout << "You entered: " << s1 << endl;;
}


你可能感兴趣的:(字符串处理函数)