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 ;)

Recommended Answers

All 7 Replies

Member Avatar for iamthwee

Show us your code.

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.

Member Avatar for iamthwee

Yes it is possible.

how??

>how??
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;
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.