Welcome to Dream.In.Code
Getting C++ Help is Easy!

Join 132,628 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,040 people online right now. Registration is fast and FREE... Join Now!




execute both condition

 
Reply to this topicStart new topic

execute both condition

amitx
post 28 Mar, 2006 - 02:51 AM
Post #1


New D.I.C Head

*
Joined: 2 Feb, 2006
Posts: 10


My Contributions


what will be the condition to execute both statements
for example this code must print "hello world"

CODE

if (condition)
    printf("hello");
else
    printf("world");


This post has been edited by Dark_Nexus: 29 Mar, 2006 - 09:19 AM
User is offlineProfile CardPM

Go to the top of the page

Mrafcho001
post 28 Mar, 2006 - 01:24 PM
Post #2


D.I.C Addict

Group Icon
Joined: 1 Nov, 2005
Posts: 753



Thanked 5 times

Dream Kudos: 120
My Contributions


in that code it is not possible to print both...

You'd need to edit the code, but even then the else part will never execute if the if statement is true, and the if statement would never execute if its false, but the else would.
User is offlineProfile CardPM

Go to the top of the page

Reply to this topicStart new topic
Time is now: 11/23/08 03:45AM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month