Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Need help!!!
Index -> Programming, C++ -> C++ Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
alexlilili




PostPosted: Fri Oct 03, 2008 1:22 pm   Post subject: Need help!!!

The question is like:
Build a simple ?English language? calculator that does the following:
takes three inputs from the keyboard, two of them single digits (0 to 9) and one a character from t
representing one of five operators: + (addition), - (subtraction), * (multiplication), / (division),
and % (modulus/remainder). Outputs the description of the operation in plain English, as well as the numeric result.

But i dont how can make "Outputs the description of the operation in plain English, as well as the numeric result"? Question Question Question

plz help!!!
Sponsor
Sponsor
Sponsor
sponsor
Insectoid




PostPosted: Fri Oct 03, 2008 1:24 pm   Post subject: RE:Need help!!!

Please, name your thread appropriately. Nobody will help you with a title like this, especially as there is a sticky telling you not to.
[Gandalf]




PostPosted: Fri Oct 03, 2008 5:36 pm   Post subject: RE:Need help!!!

I'm assuming something like:
code:
int num1(5), num2(7);
std::string operator("plus");
std::cout << num1 << operator << num2 << "=" << (num1 + num2) << std::endl;

Code from memory, so allow mistakes. Try to be more specific in what you ask in the future.
Rigby5




PostPosted: Thu Oct 09, 2008 10:24 pm   Post subject: Re: Need help!!!

alexlilili @ Fri Oct 03, 2008 1:22 pm wrote:
The question is like:
Build a simple ?English language? calculator that does the following:
takes three inputs from the keyboard, two of them single digits (0 to 9) and one a character from t
representing one of five operators: + (addition), - (subtraction), * (multiplication), / (division),
and % (modulus/remainder). Outputs the description of the operation in plain English, as well as the numeric result.

But i dont how can make "Outputs the description of the operation in plain English, as well as the numeric result"? Question Question Question

plz help!!!



This sounds like a simple homework assignment, so you should not be asking for that much help.
But in general, the idea is that you have to expect the numeric values and operator char to come in some particular and consistent order, that it appears you can choose.
After you have all 3, you can test the operator char in order to determine what sort of math you are supposed to do on the numeric values.
In the same test, you also choose the word string you are going to output to describe the operation in plain English.
By that I mean "added to", "subtract from", "multiplied by", "divided by",
or "mod of" and "and remainder".

For example, if the inputs are:
9,2,+
Then the output could be:
2 added to 9 is 11.
Display posts from previous:   
   Index -> Programming, C++ -> C++ Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: