#include
#include
using namespace std;
int main()
{
char str[100];
cout<<"输入一个字符串"<gets(str);
int i=0,k=0;
for(i=0;iif(str[i]!=' ')
k++;
cout<<"输入的字符有"<}
#include
#include
using namespace std;
int main()
{
string str;
cin >> str;
cout << "输入的字符串为:" << str << " 长度为" << str.size() << endl;
return 0;
}
#include "stdafx.h"//vc++6.0加上这一行.
#include
#include
using namespace std;
void main(void){
string str("");
char ch;
cout << "Type a string...\nstr=";
while((ch=getchar())!='\n') str+=ch;
cout << "The string is " << str << ".\n" << "The length = " << str.length() << ".\n";
}