English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

6 answers

logically impossible, the moment the compiler executes the if statement it will skip the else statement

2007-03-06 17:29:12 · answer #1 · answered by abd 5 · 0 0

No you can't but if you use a swicth statement in C, C++ (NOT C.net and possibly C# as the functionality changed) you can e.g.

Switch (value) {
case 1:
doa();
case 2:
dob();
break;
default:
doc();
break;
}

Because the "case 1" does not contain a break statement it will fall through and execute the code in "case 2" so this is the same as

if (val == 1)
doa();
dob();
else if(val == 2)
dob();
else
doc();

2007-03-06 19:51:26 · answer #2 · answered by Anonymous · 0 0

In program logic, you are asking for a contradiction. If implies choice/s, else is when the choice/s do not satisfy the criteria for the, "IF".

To execute both the satisfied IF condition and the Unsatisfied, "ELSE" condition, "Example: If apple - do Pie, Else do Hot Rolls."

To satisfy your question; in the Do Pie, complete that Routine and then do the coding for Hot ROLLS.

Does that help!



Computer Help Page

http://www.nu2.nu/pebuilder/ http://oss.netfarm.it/winpe/
http://www.paraglidernc.com/ http://www.bootcd.us/

VISTA Upgrade or Requirements

http://www.microsoft.com/windows/products/windowsvista/buyorupgrade/upgradeadvisor.mspx

http://www.diskgenius.com/

http://www.pcbeginner.com/tools/pcdoctor.htm

http://www.pcguide.com/byop/index.htm

http://www.ntfs.com/boot-disk.htm

http://www.softpedia.com/get/System/Boot-Manager-Disk/

http://www.freedownloadscenter.com/Best/ntfs-boot-iso.html

http://www.disk-image.net/products.htm

http://www.bootdisk.com/bootdisk.htm

http://www.errornuker.com/info/01.php?hop=product1

http://www.nu2.nu/pebuilder

http://www.majorgeeks.com/downloads2.html

http://www.ntcompatible.com/Acronis_True_Image_9.0_Build_2337_s61449.html

http://www.theosfiles.com/

http://www.data-recovery-reviews.com/windows-startup-disasterrecovery.htm?gclid=CMSl0b7X2YcCFSJxYAodKy6Lpw

http://www.winternals.com/

http://www.pcworld.com/downloads/file/fid,25181-order,1-page,1-c,alldownloads/description.html

http://www.softpedia.com/get/System/Boot-Manager-Disk/Windows-XP-PowerPacker.shtml

http://www.extremetech.com/article2/0,1697,674406,00.asp

http://windows.about.com/od/tipsarchive/l/bltip632.htm
Visit our Helpdesk for PC Bug Doctor
http://www.maximumsoftwaresupport.com
PC Beginner software
http://www.pchell.com/support/limitedconnectivity.shtml
http://www.nu2.nu/pebuilder/
http://www.bootdisk.com/utility.htm
Chapter 1: Purchasing Components
Chapter 2: Component Overview
Chapter 3: Installing the CPU, Heatsink, and RAM On The Mainboard
Chapter 4: Installing The Mainboard In The Case
Chapter 5: Installing Drives
Chapter 6: Connecting Components
Chapter 7: Installing AGP and PCI Cards
Chapter 8: Testing the System and Completing Assembly
Chapter 9: Installing Windows XP
Chapter 10: Configuring Windows XP
Chapter 11: Installing A Dual Boot Operating System (Linux And Windows XP)
Chapter 12: Home Video -- “So, You Want to Be the Next Steven Spielberg?”
Chapter 13: What’s Next?

http://www.hardwareanalysis.com
http://www.majorgeeks.com/download4007.html
http://www.nu2.nu/bootdisk/
http://www.free-pc-checkup.com/
http://www.pctools.com/registry-mechanic/?ref=Googlebspeed
http://pcperformancetools.com/recovermyfiles.htm
http://free.grisoft.com/freeweb.php/doc/...
http://www.download.com/3000-2144-100459...
http://www.worldstart.com/tips/tips.php/...
http://www.aarp.org/learntech/computers/...
http://www.microsoft.com/windowsxp/using...
http://www.zonelabs.com/store/content/co...

BUILD YOU OWN COMPUTER:
www.directron.com
www.newegg.com

A Good PC Cleaner

http://www.pc-error-cleaner.com/?gclid=COzW8YTD0ogCFRL1YgodAD0pbg

NTFS Boot Disk:

http://www.ntfs.com/boot_disk_includes.htm

To place Active@ KillDisk Pro onto a floppy disk type the following at the command prompt:
COPY G:\KILLDISK.EXE A:
COPY G:\DOS4GW.EXE A:
The above assumes that the G:\ drive is the bootable CD-ROM drive and the A:\ drive is the floppy disk drive.
DOS4GW.EXE is a required file for Active@ KillDisk, Active@ UNERASER and Active@ Disk Image.

http://www.download.com/BartPE-Bootable-Live-Windows-CD-DVD/3000-2094_4-10611130.html

2007-03-06 17:59:43 · answer #3 · answered by Anonymous · 0 1

YOur question itself says not possible.
If else : is a branching statement which helps in executing either if part or else part.

i hope you are asking this question because someone showed you output wher both parts are executed!!

it is possible if you are creating thread and thread is running the else part main is running if part ( or vice-versa)

Or one tricky question

if()
printf("Good");
else
printf(" morning");


and expecting the output as Good Morning.
This is not exactly related to if statement, but the return value from printf function
You can do this by setting the somecondition into !printf("Good")

if(!printf("Good"))
printf("Good");
else
printf(" morning");


Hope it serve your need.
PC

2007-03-06 17:39:04 · answer #4 · answered by PC 4 · 0 0

Some time in a multi processing CPU, both cases get executed and the invalid one is discarded.

2007-03-06 17:41:39 · answer #5 · answered by ⊂( ゚ ヮ゚)⊃ 4 · 0 0

you won't be able to analyze 2 array-strings with "==" operator. attempt to apply "strcmp" function. int strcmp(const char* s1, const char* s2) the explanation it would not artwork is that the variable call of a character array in C/C++ is actual a pointer to 3 area of memory the place the array starts. So 2 "strings" should not be "equivalent" till they the two element to a similar memory area.

2016-11-23 12:35:22 · answer #6 · answered by ussery 4 · 0 0

fedest.com, questions and answers