指针

来源:互联网 发布:新开淘宝店没生意怎么办 编辑:程序博客网 时间:2024/05/19 02:42
#include<iostream>
#include<string>
using namespace std;


class Welcome
{
private:
char *str;
public:
void Talk();


};


void Welcome::Talk()
{
 str=new char[100];
 for(;;)
 {
cout<<"input:"<<endl;
gets(str);
if(strcmp(str,"ok")==0)break;
cout<<"output:"<<endl<<str<<endl;
 }
}


void main()
{
 Welcome v;
 v.Talk();


}
0 0