473,786 Members | 2,611 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

why does this prg does not display "NONE"

int a=10;
switch(a)
{
case '1':
printf("ONE\n") ;
break;
case '2':
printf("TWO\n") ;
break;
defa1ut:
printf("NONE\n" );
}

Sep 20 '06 #1
5 1502
sunny said:
int a=10;
switch(a)
{
case '1':
printf("ONE\n") ;
break;
case '2':
printf("TWO\n") ;
break;
defa1ut:
Well, duh.
printf("NONE\n" );
}
--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
Sep 20 '06 #2
sunny wrote:
int a=10;
switch(a)
{
case '1':
printf("ONE\n") ;
break;
case '2':
printf("TWO\n") ;
break;
defa1ut:
printf("NONE\n" );
}
propably because a does not have value defalut :-)
../Preben
Sep 20 '06 #3
check the spelling of default ... and dont waste others time with such
hopeless questions
Preben Traerup wrote:
sunny wrote:
int a=10;
switch(a)
{
case '1':
printf("ONE\n") ;
break;
case '2':
printf("TWO\n") ;
break;
defa1ut:
printf("NONE\n" );
}
propably because a does not have value defalut :-)
./Preben
Sep 20 '06 #4

sunny a écrit :
int a=10;
switch(a)
{
case '1':
printf("ONE\n") ;
break;
case '2':
printf("TWO\n") ;
break;
default:
printf("NONE\n" );
}
Because it seems that with the quotes, you're evalutating the character
(ascii code), not the value itself.
Try :
switch(a)
{
case 1 :
Sep 20 '06 #5
sunny wrote:
int a=10;
switch(a)
{
case '1':
printf("ONE\n") ;
break;
case '2':
printf("TWO\n") ;
break;
defa1ut:
printf("NONE\n" );
}
Why do people continue to post this lame snippet?
Sep 20 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
40767
by: Dan R Brown | last post by:
I have a large form that is generated dynamically in a jsp using xml / xslt. So, to break up this form into several "tabbed" sections, I break up the form using <div> tags. Each <div style="display:none"> can be displayed by setting the style attribute to "display:", or hidden with "display:none". This gives the illusion that the person filling out the form is switching from page to page...without the overhead of extra hits on the server,...
5
9825
by: Sue | last post by:
Help! I have an asp table with an embedded table. The asp tablerow that contains this table has a static ID assigned of "FilterRow2" (see snippets of code below). When I click on the button to set the tablerow style property to "None", the row (And embedded table) briefly disappear, but then bounce right back into sight. Any ideas on why it's doing this and how to make the style.display = "None" stick?
5
4641
by: z. f. | last post by:
sorry about the previous post, by mistake not completed. i have an asp.net page with the line <%@ OutputCache Duration="30" VaryByParam="none" %> but when i make requests to the page with different parameters, i get different result, but i tries to check if i set the VaryByParam to none there should be the same output for different parameters, so why does it not work?
3
4491
by: Stan Brown | last post by:
Posted by Pierre Blais in the current RISKS Digest: http://catless.ncl.ac.uk/Risks/24.24.html#subj9 -- Stan Brown, Oak Road Systems, Tompkins County, New York, USA http://OakRoadSystems.com/ HTML 4.01 spec: http://www.w3.org/TR/html401/ validator: http://validator.w3.org/ CSS 2.1 spec: http://www.w3.org/TR/CSS21/ validator: http://jigsaw.w3.org/css-validator/
2
9611
by: Good Man | last post by:
Hi there I have quite a bit of experience with CSS but I am stumped by the following: http://www.electricphase.com/example/example1.php (uses http://www.electricphase.com/example/test1.css) http://www.electricphase.com/example/example2.php (uses http://www.electricphase.com/example/test2.css)
1
1223
by: --== Alain ==-- | last post by:
Hi, I've seen that on all component it is possible to have (none) as value for a property. Usually i see it for Image or ImageList property type. So tried it on my component. I can set the image without problem, but i can not clear the property if i do not want to use it... to clean the property, i mean by that, to not allocate an image data to it... so it should display (none) as value.
6
29299
chunk1978
by: chunk1978 | last post by:
hi there... i'm about to embark on my very first PHP code journey (i've been saying that for a while... so sometime soon i hope... anyway)... before i begin my exciting new journey into PHP land, i would like to know if PHP will send hidden HTML form elements or not?... for example: if a user makes a selection in my HTML form that triggers my wonderfully dynamic HTML to set a DIV to STYLE="DISPLAY:NONE", is it possible to tell PHP not...
4
70094
by: gimme_this_gimme_that | last post by:
Hi, I have an onchange method for a select box that goes something like this (the select is in a form named aForm): function page_on_change() { pageElement = aForm.my_page_id; aForm.nav_page_name.value = pages.value]; var si = pageElement.selectedIndex;
3
2787
by: Kappucino XL | last post by:
Hi there... What is the VBA Code for inserting the string "none", in every blank textbox, in a report? My system, generates a report from a query. eg: textbox1: FirstName ; textbox2: Middle Name; textbox3: LastName! Now, my report will display everyone's FirstName, MiddleName, LastName from the query. Incase someone does not have a middle-name, I need the word "None", to be displayed, on the the report? How do I go about doing this? My...
0
9497
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10363
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8992
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7515
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6748
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5398
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5534
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4067
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.