Hi i need help again in C++(i know i need a lot of help
)
I was doing this class inplementation thing, one part where i need to record some characters. So in the member function i just use:
cout<<endl<<"Enter your message: ";
cin.get(Greeting,200);
cin.ignore(200,'\n');
Write.open("asdf.txt", ios:: out);
Write<<Greeting;
Write.close();
i thought the character array (which i already declared in the private area) will record what user typed in. Well, it got out of control, the program skipped the step and goes to the next cout statment after the codes above. Why did it skip?!?!?! I tried to use the same code in my client program, the same thing happened. But when i made a new program, with just the codes and some declaration of the Write and Greeting, it didn't skip! :Q can someone explain it to me why it happens and how can i fix it? Thanx
I was doing this class inplementation thing, one part where i need to record some characters. So in the member function i just use:
cout<<endl<<"Enter your message: ";
cin.get(Greeting,200);
cin.ignore(200,'\n');
Write.open("asdf.txt", ios:: out);
Write<<Greeting;
Write.close();
i thought the character array (which i already declared in the private area) will record what user typed in. Well, it got out of control, the program skipped the step and goes to the next cout statment after the codes above. Why did it skip?!?!?! I tried to use the same code in my client program, the same thing happened. But when i made a new program, with just the codes and some declaration of the Write and Greeting, it didn't skip! :Q can someone explain it to me why it happens and how can i fix it? Thanx