kindly help me n tell me in 2 dimension array wen we r taking words as input then cin would be used or getch..???plz replay.me waiting

In the absence of specific details about what you're trying to do, cin is a perfectly good way to input words in C++.

Just include the <string> header - #include<string>

cin would be used or getch

First of all, getch() is not a standard function. Avoid using it.

Secondly, getch() won't echo what user have entered, that is it will not show in screen what user has entered.

Third, use cin when you are taking just a single word, because if you use space in between, cin will not work properly. It would only take the part before the space.

# include <iostream>

 using namespace std;

 int main()
 {

    char c[100];

    cin >> c;

    cout << c;
 }

Run this and see what happen. When you want to enter a sentence ( that is spaces will be present ) , use fgets().

commented: getline() can also be used +0

When you want to enter a sentence ( that is spaces will be present ) , use fgets().

Don't you mean cin.getline()? This is C++...

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.