943,740 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 712
  • C++ RSS
Feb 16th, 2008
0

program in c++

Expand Post »
please help me to write a program in c++ to find sum of first and last digits of any number
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
rathmal is offline Offline
4 posts
since Feb 2008
Feb 16th, 2008
0

Re: program in c++

have you written some code?
Featured Poster
Reputation Points: 431
Solved Threads: 116
Practically a Master Poster
Agni is offline Offline
654 posts
since Dec 2007
Feb 16th, 2008
0

Re: program in c++

Break the problem down into small tasks.

First, you need to find a way to get the first digit and the last digit.

There are many different ways you could get these digits.

One way might be to convert the number into a string. Once you have the string, there are several ways you can get the first and last character.

Convert those characters representing the first and last digit to an int.

Once you have those digits, simply add them together.
Reputation Points: 13
Solved Threads: 12
Junior Poster in Training
codeaa is offline Offline
98 posts
since Feb 2008
Feb 16th, 2008
0

Re: program in c++

Click to Expand / Collapse  Quote originally posted by rathmal ...
please help me to write a program in c++ to find sum of first and last digits of any number
/ and % can come handy.
SpS
Reputation Points: 70
Solved Threads: 32
Posting Pro
SpS is offline Offline
598 posts
since Aug 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Linker Error - Multiple Definition
Next Thread in C++ Forum Timeline: Need advice for data storage





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC