The language i'm trying to do this in is c++ let's say i have a number 123456 , i want to divide this up into partitions of two so i would have: 12,34,and 56. I want to add the partitions up and it would equal 102. How can this be done in c++? Thanks for the feed back :D:D
jwill222
0
Newbie Poster
Recommended Answers
Jump to PostYou could convert the number into a string, then creating substrings of every two characters, and then parse them back to int and add them together?
Another approach would be using modulus, adding the rests of your value x mod 100, 10000 (then split by 100) and so on.
Good …
All 3 Replies
Reply to this topic
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.