I received an assignment which ask for simple calculations between server and client such as addition, subtraction, multiplication, division, etc.
Currently, I had finished the calculation part, where client could input in 2 numbers and the operation they want to the server so the server could do the calculation and send back the result to client. The problem I'm facing now is, how could I restrict the client side so that they are only allowed to input numbers and not characters?
This is a small part of my codes :
Anyhelp would be appreciated, thanks.Code:// Reply first number char firstnum[256]; cin >> firstnum; send( theSocket, // Connected socket firstnum, // Data buffer strlen(firstnum), // Length of data 0);![]()



LinkBack URL
About LinkBacks



