Sir we cannot use the cin.getline( ) function to take input a string it is valid for taking input in char array and can you tell me the there is any other method to take input a string?

basically can you tell me the difference between the string and char array and differences between them in terms of taking input

string is a inbuilt class define in c++ stl

char array is the derived data type
you can only store data in it
array is raw no add on function

in string you have many inbuilt function which you can use

for string you can use
getline(cin, str);

for char array you can use
cin.getline(str,size);

Reference Code

you can refer this article for more detail