user'll only be able to enter predetermined vals

Apr 5, 2015 at 4:15pm
<code>
#include <iostream>

using namespace std;

int main
{
char A[12]="47000000000";
char B[12]="47000000000";
char C[12]="47000000000";
cout << "Enter 3 numbers to multiply(1-13 digits): ";
cin >> A[11];
cin >> B[11];
cin >> C[11];
char D[39]="10382300000000000000000000000000000000";
cout << D << D[38] << endl;
cin >> D[38];
}
</code>

What changes should I make to the computer program above
to allow the user to enter any values that fits within the
array sizes: [12] , [12] , [12] , [39] .
Last edited on Apr 5, 2015 at 4:16pm
Apr 5, 2015 at 4:26pm
You can use unsigned long double data type.

PS: Please use code tags...
Last edited on Apr 5, 2015 at 4:30pm
Apr 5, 2015 at 11:03pm
I did use (code tags) you should have paid attention to the contents of my first post!
Because if you did, you would see them right where they need to be.
Last edited on Apr 5, 2015 at 11:04pm
Apr 5, 2015 at 11:14pm
@cppnerd. Your Post Does not have code tags in any way shape or form. Look closer...

With Code tags:

int x = 5;

Without:

int x = 5;
Last edited on Apr 5, 2015 at 11:25pm
Apr 6, 2015 at 12:59am
code tags are used by [ code ] [ /code ] (ignore the white spaces) and not by <code> </code>

I think your habit of using <> is because of html, isn't it @cppnerd?
Apr 6, 2015 at 3:35am
programmer007 wrote:
unsigned long double


What is that? Not a legal C++ type I am sure.

There are external libraries like GMP and many others, that will handle arbitrarily large integers. Check out Boost as well.

http://en.wikipedia.org/wiki/List_of_C%2B%2B_multiple_precision_arithmetic_libraries
http://www.boost.org/doc/libs/1_53_0/libs/multiprecision/doc/html/boost_multiprecision/intro.html


Hope all is well :+)
Apr 6, 2015 at 3:47am
I believe this is what you're looking for:
http://en.cppreference.com/w/cpp/io/basic_istream/readsome

-Albatross
Apr 6, 2015 at 3:48am
@cppnerd. Your Post Does not have code tags in any way shape or form. Look closer...

yes he does. they just arent cplusplus.com compliant.

What is that? Not a legal C++ type I am sure.

certainly not.

There are external libraries like GMP and many others, that will handle arbitrarily large integers. Check out Boost as well.
those are good recommendations. for further research you can google bignum libraries op
Apr 6, 2015 at 9:49am
my bad...
unsigned long int

will that work?
Apr 6, 2015 at 10:07am
@programmer007

No. Look up the maximum value for that type and see how many digits it has :+)

One needs a library to do this because the largest unsigned value (64 bit) is still not big enough.

Regards :+)
Apr 6, 2015 at 11:18am
Just curious
Which is the most precise data type (within standard library)???
Apr 6, 2015 at 12:06pm
@programmer007

Well, on a 64 bit machine unsigned long long int

But it is better to use a cstdint.h type like uint64_t (platform independent). The maximum is still 64 bit which is about half of what the OP requires.
Apr 6, 2015 at 12:42pm
thanxx @TheIdeasMan...
Topic archived. No new replies allowed.