### An Question waiting to solve(about uva424)

The following codes is the solving of uva424, but there are a some problems in these codes, who can help me to solve these annoy problem?
The codes wroten as follow:
 ``123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176`` ``````#include #include using std::istream; using std::ostream; using std::cin; using std::cout; using std::endl; #define M 10100 #define N 10100 //10100 class bigInteger { private: char *Int; public: bigInteger(char *num); bigInteger(char*num,int size); ~bigInteger(); void Insert(char num); bool operator !=( bigInteger &num); bigInteger & operator +=( bigInteger &num); friend istream & operator>>(istream &input, bigInteger &num); friend ostream & operator<<(ostream &output, bigInteger &num); friend void tranCtoN(char Int[]); friend void tranNtoC(char Int[]); }; int main() { // while(cin) { bigInteger sum("0",N);//累加和 bigInteger end("0");//结束数据 bigInteger num("\0",M); //存放读入的大整数 while(cin>>num && num!=end) { sum+=num; } cout<(strlen(num))?size:(strlen(num)); Int=new char [temp+1]; strcpy(Int,num); } bigInteger::~bigInteger() { delete [] Int; } void tranCtoN(char Int[]) { int i; for(i=0;i=0;i--) { Int[i+1]=Int[i]; } Int[i+1]=num; } bool bigInteger:: operator !=( bigInteger &num) { int i; if(strlen(Int)!=strlen(num.Int)) { return true; } else { for (i=0;Int[i]!='\0';i++) { if(Int[i]!=num.Int[i]) { return true; } } return false; } } bigInteger & bigInteger:: operator +=(bigInteger &num) { int i,j; int temp; i=strlen(Int); j=strlen(num.Int); temp=i>j?i:j; if(temp>i) { for(i;ij) { for(j;j=0;i--) { if(i==0) { if((num.Int[i]+Int[i])/10) { char tempchar=Int[i]; Int[i]=(num.Int[i]+Int[i])%10; Insert((num.Int[i]+tempchar)/10); } else { Int[i]=(num.Int[i]+Int[i])%10; } } else { Int[i-1]=(num.Int[i]+Int[i])/10+Int[i-1]; Int[i]=(num.Int[i]+Int[i])%10; } if(Int[i]=='\0') { Int[i]='*'; } } tranNtoC(Int); return *this; } istream & operator>>(istream &input, bigInteger &num) { char temp[1000]; input >> temp; delete [] num.Int; num.Int = new char[strlen(temp)+1]; strcpy(num.Int,temp); return input; } ostream & operator<<(ostream &output, bigInteger &num) { output << num.Int; return output; }``````

If you know those problems, whether you can solve it, please tell where are those problems!
P.S:uva 426 :http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=6&page=show_problem&problem=365
Last edited on

 ``` 12 123 0 135 Press any key to continue ```
 ``` 12 12 0 24 Press any key to continue ```

Wrong answer in the following input :
 ``` 12 1 0 ```
(There is a prompt displaying:After Normal block(#67) at 0x00550750)
Last edited on
Who the hell reported Softrix? His/her post was good advice, and was entirely reasonable.

Thanks for the backing MikeyBoy.

To be completely honest, although it is possible it wasn't the O/P that reported my post it has actually put me off from posting any further in this thread and offering my help.

His post was all left justified and very difficult to read and I simply asked for it to be edited inside code blocks so I could look at it better. Normally I would copy and paste into VS2013 which would do that for me, but at the time of my post I was not at the office and on my mobile.

Take care.

PS. I'm a he :)

You're welcome :)

I doubt it was the OP who reported you, since they did take your advice and edit their post to use code tags. I suspect there are others here with an axe to grind.
Or it was the OP and they just mixed up the Report and Reply buttons. It happens.

In the report button you give a reason though surely, or have to select something?

I did not know that. I thought it was just a button to alert a moderator to check out the post.

I just reported myself and pressed OK with no message to see what happens. Sorry Mods, please ignore the report. Just curious.
@ LB - thanks, I thought there would be something like that so whoever decided to report my post had obviously got some indication and it is therefore less likely a mistake. oh well :)
Topic archived. No new replies allowed.