Ads 468x60px

Labels

Thursday, 13 September 2012

Switch Case control structure


SWITCH stmt is used for handling n number of decisions at a time.
 Hence it is also known as multi way decision making stmt.
SWITCH STATEMENT can't be applied to float and double.
 Break stmt transfers the control out of the switch stmt.
Syntax

switch(choice)
  {
  case 1:block of stmt:-1;
  break;
  case 2:block of stmt:-2;
  break;
  …………………….
  ……………………..
  ………………………
  case n:    block of stmt:-n;
  break;
  default: invalid stmt;
  break;
  }


sample program 

Logical operators workshop


Logical && and logical || 
logical && : If all are true then only true otherwise false.
logical || : if any one is true then it is true otherwise false.
Program on logical operators 
 A company insures its drivers in the following cases:
− If the driver is married.
− If the driver is unmarried, male & above 30 years of age.
− If the driver is unmarried, female & above 25 years of age.
In all other cases the driver is not insured. If the marital status, sex and age of the driver are

Else-if Control Structure


Else-if:
      A Multipath decision is a chain of ifs in which the statement associated with each else is an if.
Syntax:
  if(condition-1)
  stmt-1;
     else if(condition-2)
         stmt-2;
  else if(condition-3)
     stmt-3;
      ………………….
      else if(condition-n)
        stmt-n;
  else
  defalut stmt;
stmt-x;

Sample Program :

If else control structure


C  uses the keyword if-else to implement the decision control instruction.
Syntax
if(test condition-1)
{
             if(test condition-2)
  {
                block of stmt-1;
  }
  else
  {
                  block of stmt-2;
               }
}
  else
  {
     block of stmt-3;
  }
Stmt-x;

Note: braces are mandatory when, corresponding to if or else statement, multiple steps are to be executed.
Sample program 

If Control Structure


if   
C  uses the keyword if to implement the decision control instruction.
if statement can’t terminate with semicolon, but by mistake if we terminate ,compiler won’t give any error.
Syntax
if (test condition)
{
------------------------------------
------------------------------------
-------------------------------------               block of statements
--------------------------------------
}
Stmt-x;

Sample if program

Schaum's Outline of Programming with C



Head First Programming

Looking for a reliable way to learn how to program on your own, without being overwhelmed by confusing concepts? Head First Programming introduces the core concepts of writing computer programs - variables, decisions, loops, functions, and objects - which apply regardless of the programming language. This book offers concrete examples and exercises in the dynamic and versatile Python language to demonstrate and reinforce these concepts.

Learn the basic tools to start writing the programs that interest you, and get a better understanding of what software can (and cannot) do. When you're finished, you'll have the necessary foundation to learn any programming language or tackle any software project you choose.


Head First SQL

Maybe you've written some simple SQL queries to interact with databases. But now you want more, you want to really dig into those databases and work with your data. Head First SQL will show you the fundamentals of SQL and how to really take advantage of it.


Head First JavaScript

Want to make the leap from writing HTML and CSS web pages and create dynamic web applications? Want to take your web skills to the next level? It sounds like you're ready to learn the Web's hottest programming language: JavaScript. Head First JavaScript is your ticket to going beyond copying and pasting the code from someone else's web site, and writing your own interactive web pages.



Head First HTML5 Programming

HTML has been on a wild ride. Sure, HTML started as a mere markup language, but more recently HTML's put on some major muscle. Now we've got a language tuned for building web applications with Web storage, 2D drawing, offline support, sockets and threads, and more. And to speak this language you've got to go beyond HTML5 markup and into the world of the DOM, events, and JAVASCRIPTS APIs.


                                       CLICK HERE TO DOWNLOAD

Head First HTML with CSS & XHTML

Tired of reading HTML books that only make sense after you're an expert? Then it's about time you picked up Head First HTML with CSS & XHTML and really learn HTML. You want to learn HTML so you can finally create those web pages you've always wanted, so you can communicate more effectively with friends, family, fans, and fanatic customers. You also want to do it right so you can actually maintain and expand your web pages over time, and so your web pages work in all the browsers and mobile devices out there. So what are you waiting for? Leave those other dusty books behind and come join us in Webville. Your tour is about to begin.

                                                       Click Here To Download

Head First C#

You want to learn C# programming, but you're not sure you want to suffer through another tedious technical book. You're in luck: Head First C# introduces this language in a fun, visual way. You'll quickly learn everything from creating your first program to learning sophisticated coding skills with C# 4.0, Visual Studio 2010 and .NET 4, while avoiding common errors that frustrate many students.
                                     Click Here To Download

Head First Java

                                                   Click Here To Download
     Head First Java delivers a highly interactive, multisensory learning experience that lets new programmers pick up the fundamentals of the Java language quickly. Through mind-stretching exercises, memorable analogies, humorous pictures, and casual language, Head First Java encourages readers to think like a Java programmer. This revised second edition focuses on Java 5.0, the latest version of the Java development platform.

Head First C

                Head First C provides a complete learning experience for C and structured imperative programming. With a unique method that goes beyond syntax and how-to manuals, this guide not only teaches you the language, it helps you understand how to be a great programmer. You'll learn key areas such as language basics, pointers and pointer arithmetic, and dynamic memory management.
                                     Click Here To Download