~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

start off to

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Stinking, tar layers killed shriveled sailor legs, RUTHLESSLY.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Suck, suck and more suck -- this is what our worries are doing to us.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

offline -> online

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

You get deprived of the hot soup.

I put in some mint.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

ok i am having more problems. when u run the code with a number like 1234567890 it prints out 987654321 and that is fine. but if you enter something like 123456789123456789 it prints out something else.

That would be attributed to overflow i.e. trying to store a number in an integer variable which exceeds the capacity of an integer data type.

My output:

Please input an integer: 23434324234343
original string: 23434324234343
reversed string: 34343242343432
reversed integer: 4007032 // overflow

also how can i make it not print out letters, i thought this would work. but its not

while (integer != alpha)

it does not work.

It would be :

if ( isalpha ( integer [cntr] ) || ispunct ( integer [cntr] )  )
{
    --cntr ;
}

Though there are better ways of doing the same thing in C++ using its inbuilt string functions...

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Damn, is this the same thread I started posting in a few weeks back ?

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

but you have

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

where would you

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Smelly, reeling factories burn BRIGHT, oil tanks, abandoned.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

You get to date Oprah Winfrey.

I put in a thread.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

tent

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

prejudice -> judas

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

My wife says my brain capacity is equal to a two year old. Does that count? :rolleyes:

Well, not really... ;)

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Embarassing memories take a lot of time to fade away.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

sharon -> shine

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

furl

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

curled

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Daring, reeling MANIACS burn shredded, historic paintains, floating.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

thing to be

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

You seem to be a level headed person my friend.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Daring, reeling skydivers BURN shredded, historic manuals, floating.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

we were so

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

churned

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Amsterday -> waterfalls

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

earned

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

christmas -> pastries

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Daring, idiot skydivers read shredded, historic manuals, FLOATING.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Meat ? Oh yes it was long time back I had tasted meat, but now, no.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Do you still

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Heh how is

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Looks like a moderator / supermod / admin deleted that thread by mistake.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Don't use global variables. Its a bad programming practice considering the job can be very well done using local ones.

As far as your method is considered its a bit unclean but still if you want to strip off the leading zeroes check one more condition which keeps skipping zero as long as it doesn't encounter a non zero valid digit.

Btw, I see no validation considering that the user is allowed to enter even alphabets and punctuations and get away with them...

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

You get to do rock and roll.

I put in a woollen sweater.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

a polythene bag

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Cabbage is the favourite vegetable of all vegetarians.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

broken bones and

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

learn

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Disco -> shiny balls

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

DARING, idiot skydivers read boring, historic manuals, fallling.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

I followed your link because now I'm intrigued about atoi, however is for C++ and I don't know anything about it. Do you have another link that shows why is bad to use that function in C. I have used it several times, in the past, following books examples.

The way in which I used atoi in that snippet was relatively safe since the string is only to passed to atoi if it contains only digits and nothing else (I make this sure in the if condition). So the chances of junk gettting to passed to atoi are none and hence it functions properly in the given context.

I could have used stringstreams but would have been an overkill considering that I know before hand the kind of input which would be passed to the atoi. An important part of being a programmer is the proper selection of tools suiting the situation under consideration.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Another method is to make static all the methods and objects that the static method needs to access.

But I guess that would beat the purpose of designing class for creating objects since each object created would have the same thing inside of it (the member variables being static).

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Hmm..... now thats

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

risk

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Hey but thats

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

You ge woof woof.

I put in a snow flake.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Choice is normally the variable which accepts user input... ;)

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

drown -> pool

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Creepy, idiot skydivers read boring, historic books, FLYING.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

>out << atoi (my_str.c_str()) << '\n';

Don't use atoi with c++ or even c for that matter. It is best avoided. Use stringstream instead.

I just gave him a dummy and trivial working solution. If I would have used string streams it would have as well completed his project.

And btw atoi is not always bad, depends on the context which it is used. See this snippet.