How may I clear whole array in that example?

#include <iostream.h>
#include <string.h>
#include<conio.h>
using namespace std;
class C_String 
{
      public:
             char* Input();
             void Output( );
      private:
           char array[30]; 
};
char* C_String::Input()
{
      cin.getline(array,30);
}
void C_String::Output()
{
     cout<<array;
}
int main()
{
    C_String some_data;
    char array[30];
    
    cout<<"enter sopme input ";
    some_data.Input();
    some_data.Output();
    
    
    getch();
    return 0;
}

thanks

>>How may I clear whole array in that example
code a constructor and use memset() to clear it.

Line 3: conio.h is non-standard file that contains non-standard functions. You don't need it in the code you posted because there are c++ alternatives that are standard -- such as cin.ignore().

Ok
and how may I do that, I have no clue, first time using that kind of stuf and can't find an answere nowhere
Any suggestions
Thanks

class C_String 
{
      public:
             C_String() { memset(array,0,sizeof(array));}
             char* Input();
             void Output( );
      private:
           char array[30]; 
};

>>first time using that kind of stuf and can't find an answere nowhere
you really should get an Introduction to C++ book. All sorts of helpful stuff in the Readme threads at the top of this board.

Hi
Don't want you make mad or anything, I know that stuff is easy for you. Could you put it all together in the program I wrote before, just to see how it will work. I tried many things and guess what, nothing. Could you put all this pieses together and then can I print the array to see that there is nothing
Thanks

>>Don't want you make mad or anything
Don't worry -- you won't.

>>Could you put it all together in the program
Already did that. Just replace lines 5 thru 12 with the small bit of code I posted. You don't need to change any of the other code you posted.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.