hi,
i have one question:
does anybody know how to end program.
i have one function in whom i calculate two numbers.
i want to end program if my number is to big

for example
12345 + 91111=103456

but i don't want that my has 6 digits so i want to exit

So

if(result > 99999) return 0;

*mumbles about multiple exit points*

Chris

commented: :) +9

Or *mumble mumble*

if(result > 99999)
{
    exit(1);
}

What they are trying to say is, it's bad practice to exit your program spontaneously. Objects would be left undestroyed, memory orphaned, and it just doesn't look professional. Instead, use logical blocks (if/else, switch, while, etc) to stream something like that (an exit condition) towards the final return call in main().

thank you all very much, i think i know now;)

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.