i would like to make a client choose with words rather than numbers.

Instead of the conventional way of using numbers to retrive commands i need to make a client write words for example they type in "add" to get 2 numbesr to add and so on.

any help is apreciated ;)

10 Years
Discussion Span
Last Post by Narue

well i don't have a code its just i have no idea how to and i was just wondering if it was even possible and if it is how to do it.


Probably with string input. With over 20 posts, you should be aware of how we expect the Q&A process to work. You're a part of the process, which means we're not just going to tell you how to do things. You have to think about it yourself and show at least a modicum of effort before we'll do the same.


well the way i though was like this

char add[3]= "add";
cin >> add;

thats the way i pictured it n my memeory


>thats the way i pictured it n my memeory
That's pretty darn close to what you should be doing. Though it would be better to generalize it a bit and add some buffer protection:

char word[32]; // Assuming no expected words are longer than 31 characters
cin>> setw ( 32 ) >> word;
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.