I can get any number to work as long as it doesnt include a 0. If it has a 0 the reversed number just comes out with the 0 on the end. I cannot figure out why. I think may have just made it too complicated and need to redo it. But if someone can help me I would appreciate it
[CODE=cpp]
int reverseDigit(in t a)
//reverseDigit reverses the order of the digits in an integer. So 1234 becomes 4321
//It only has to be...
User Profile
Collapse
-
nah, the function is given two numbers:
the default, which is length and other which would be called from other.(whatever variable you need)
LongInt LongInt::multip lication(LongIn t other) const... -
Here is my class:
class LongInt
{
public:
LongInt();
LongInt(int[], int);
void print();
void read();
LongInt add(LongInt)con st;
LongInt subtract(LongIn t)const;
LongInt multiplication( LongInt other)const;
void setLength(int);
void createIntArray( int);
int getLength();
void printOper();
private:
int *a;...Leave a comment:
-
Algorithm Help
As part of a program I have to multiply two long numbers out, numbers that dont fit in any int. I feel that I have the algorithm right, but somehow the code just isnt working out and I cannot see why.
First you multiply the top and the bottom, this gives you sum
If sum is larger than ten you take % 10 to find the remainder and set that to the result in the first array position plus whatever is already (which the first time through... -
-
so its just a memory issue? not even an unsigned long int wont hold the a that large?Leave a comment:
-
loop problems/memory problems?
I am writing a C++ program for class, I am fairly new to C++ but have plenty of programming history. I have to split up a integer into an array. but I am having trouble just getting the count for the array!
[CODE=cpp]#include <iomanip>
#include <iostream>
using namespace std;
class LongInt
{
public:
LongInt();
LongInt(int[], int);
void print();...
No activity results to display
Show More
Leave a comment: