Inserting an string using cin.getline() and want to print that string on console using cout.write().Prints the entered string after I quit the application
#include<iostream.h>
#include<conio.h>
int main() {
char str[20];
cout<<"Enter a string:";
cin.getline(str,20);
cout<<"Entered string:";
cout.write(str,20);
cout.flush();
getch();
return 0;
}