Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > I need Help

Reply
Thread Tools

I need Help

 
 
k_o_l@hotmail.com
Guest
Posts: n/a
 
      02-11-2005
Hi all,

I'm new to C++, and I'm trying to add the last two digits of a number.
for example, 1988 , 8+8=16 any idea on how to do that?

thanks.

 
Reply With Quote
 
 
 
 
Victor Bazarov
Guest
Posts: n/a
 
      02-11-2005
wrote:
> I'm new to C++, and I'm trying to add the last two digits of a number.
> for example, 1988 , 8+8=16 any idea on how to do that?


Read about operator / (division) and operator % (remainder). We're not
going to do your homework for you.
 
Reply With Quote
 
 
 
 
Chris Soanes
Guest
Posts: n/a
 
      02-11-2005
wrote:
> Hi all,
>
> I'm new to C++, and I'm trying to add the last two digits of a number.
> for example, 1988 , 8+8=16 any idea on how to do that?
>
> thanks.
>


*checks date* nope, not september.

This sounds suspiciously like a homework question. We try not to do
people's homework on here, if we can. However, here's a hint:
Convert the number to a string and exctract the last two characters.
Convert them back to numbers and add them. Don't forget to check the
string first to make sure it's really a number.

Another hint:

http://www.parashift.com/c++-faq-lit...t.html#faq-5.2

Please to not take offence at the above post. I can assure you that none
was meant.
Welcome to the group; we all hope you stick around and grow to love C++
as we do.

Tiff

--
Chris M Soanes: Amateur Sailor, Windsurfer, Cyclist, Biker, Mechanic,
Welder, Snowboarder, Swimmer, Dog Owner, Real Ale Drinker; Professional
Geek.
Its not a saviour that we want, just somebody else to crucify! - NMA

 
Reply With Quote
 
Ioannis Vranos
Guest
Posts: n/a
 
      02-11-2005
Chris Soanes wrote:

> *checks date* nope, not september.
>
> This sounds suspiciously like a homework question. We try not to do
> people's homework on here, if we can. However, here's a hint:
> Convert the number to a string and exctract the last two characters.
> Convert them back to numbers and add them. Don't forget to check the
> string first to make sure it's really a number.




That works but there is an easier numerical way.




--
Ioannis Vranos

http://www23.brinkster.com/noicys
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help Help, I am intermediate in Java...need help in follow case ElementX Java 9 10-01-2008 08:02 PM
Help Help. I really need some help with this =?Utf-8?B?Q2hyaXM=?= ASP .Net 3 01-31-2007 09:33 PM
re_---need help Network Adapters!!!! NEED HELP!!!! hedayatniac@gmail.com Computer Support 4 08-13-2006 01:03 AM
Need help! I need to add lead zeros to a textbox Teep ASP .Net 2 06-21-2004 01:04 PM
Please help!!! Need datagrid selection to fill textboxes...Need quick!! TN Bella ASP .Net 1 06-18-2004 01:31 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57