有长度限制,不过在长度限制之内不知长度,能用代码演示一下吗?谢谢.
能用代码演示一下吗?谢谢.
追答#include <iostream>那个我是学c++的,看不懂c,能用c++编一段吗?谢谢.
追答会动态定义长度了么(new)
追问动态定义长度?不大清楚.
追答我用手机不太好打代码,明天再把代码给你把,实现方法其实挺多的……
方案1:
#include
#include
using namespace std;
int main()
{
string str;
cin>>str;
cout
#include
using namespace std;
int main()
{
char s[255];
cout
using namespace std;
int main()
{
char s[255];
cout>s;//注意!!
cout<<"你输入的字符串为:"<<s<<endl;
return 0;
}