Academic Tutorials



English | French | Portugese | German | Italian
Google

Home Testimonials Advertise Contact Us About Us Link to Us
Source Codes E-Books Downloads Jobs Web Hosting Chats

C++ Tutorial
Introduction to C++
C++ Concepts
A C++ Program
Variables in C++
Operators in C++
Control Statements
C++ Functions
C++ Classes
C++ Objects
Constructors and Destructors
Pointers to the Classes
C++ Overloading
Friend Function
Virtual Functions
Exception Handling in C++
C++ Templates
C++ Summary

HTML Tutorials
HTML Tutorial
XHTML Tutorial
CSS Tutorial
TCP/IP Tutorial
CSS 1.0
CSS 2.0
XML Tutorials
XML Tutorial
XSL Tutorial
XSLT Tutorial
DTD Tutorial
Schema Tutorial
XForms Tutorial
XSL-FO Tutorial
XML DOM Tutorial
XLink Tutorial
XQuery Tutorial
XPath Tutorial
XPointer Tutorial
RDF Tutorial
SOAP Tutorial
WSDL Tutorial
RSS Tutorial
WAP Tutorial
Web Services Tutorial
Browser Scripting
JavaScript Tutorial
VBScript Tutorial
DHTML Tutorial
HTML DOM Tutorial
WMLScript Tutorial
E4X Tutorial
Server Scripting
ASP Tutorial
PERL Tutorial
SQL Tutorial
ADO Tutorial
CVS
Python
Apple Script
PL/SQL Tutorial
SQL Server
.NET (dotnet)
Microsoft.Net
ASP.Net
.Net Mobile
C# : C Sharp
ADO.NET
VB.NET
VC++
Multimedia
SVG Tutorial
Flash Tutorial
Media Tutorial
SMIL Tutorial
Photoshop Tutorial
Gimp Tutorial
Matlab
Gnuplot Programming
GIF Animation Tutorial
Scientific Visualization Tutorial
Graphics
Web Building
Web Browsers
Web Hosting
W3C Tutorial
Web Building
Web Quality
Web Semantic
Web Careers
Weblogic Tutorial
SEO
Web Site Hosting
Domain Name
Java Tutorials
Java Tutorial
JSP Tutorial
Servlets Tutorial
Struts Tutorial
EJB Tutorial
JMS Tutorial
JMX Tutorial
Eclipse
J2ME
JBOSS
Programming Langauges
C Tutorial
C++ Tutorial
Visual Basic Tutorial
Data Structures Using C
Cobol
Assembly Language
Mainframe
Forth Programming
Lisp Programming
Pascal
Delphi
Fortran
Oops
Data Ware Housing
CGI Programming
Emacs Tutorial
Gnome
ILU
Soft Skills
Communication Skills
Time Management
Project Management
Team Work
Leadership Skills
Corporate Communication
Negotiation Skills
Database Tutorials
Oracle
MySQL
Operating System
BSD
Symbian
Unix
Internet
IP-Masquerading
IPC
MIDI
Software Testing
Testing
Firewalls
SAP Module
ERP
ABAP
Business Warehousing
SAP Basis
Material Management
Sales & Distribution
Human Resource
Netweaver
Customer Relationship Management
Production and Planning
Networking Programming
Corba Tutorial
Networking Tutorial
Microsoft Office
Microsoft Word
Microsoft Outlook
Microsoft PowerPoint
Microsoft Publisher
Microsoft Excel
Microsoft FrontPage
Microsoft InfoPath
Microsoft Access
Accounting
Financial Accounting
Managerial Accounting
Computer Basics
Basics of Computer


Control Statements

Previoushome Next



What is the Control Statement?

Control Statement are the ways for programmer to control which pieces of the program to be executed at certain times. The syntax of the Control statements are very similar to the regular english, and they are very similar to the choices that we do make in our every day life. There exists two basic types of the control statements: branching statements and loops.




A branching statement

A branching statement is one which divides the code into certain number of branches depending upon some coditions specified. Example for branching statement is the If statement.

if (x > 0)
      cout<<x is positive integer;
else
     cout<<x is negitive integer;

Depending on the condition certain series of events will be executed. Another example for branching statement is a switch statement. Let us study switch statement later. Here in the code given above will checks the condition if x is greater than "0" or not. if it is greater then prints x is a positive number otherwise prints x is a negitive number.




Nested control statements

Here in the nested control statements, statements are nested by using the keyword If and Else

if (x>0)
      cout<<x is positive integer;
else
      if (x<0)
          cout<<x is negitive integer;
else
      cout<<x is Zero;

In the example given above there is one control statement which is inside another control statement. This method of writing program is known as nesting.




The While Statement

In this statement while keyword is been used, It checks the conditions, if it holds good then block of code is executed. Otherwise the next sequential line of code is been executed.

while (x< 0)
     cout<<x is positive integer;
end while;
     x=0;

Here if x is greater than "0" then it prints x is positive integer otherwise it simply assigns zero to x.




The for command.

This is the loop statement. A line of code or the block of code is been executed for certain number of times as specified in the for statement. There are three parameters in the for statement. First intialization, second condition and finally increement statement.

for(i=0;i<5;i++)
     cout<<i;

A for statement execute a code for specified number of times. In this instance it executes 5 times. It executes until the condition "i<5" fails.




The switch statement

A switch statement allows the programmer to compound the group of if statements, provided that a condition being tested is integer. A switch statement is of the form shown below:

switch(integer_val)
{
      case val_1:
      // code to execute if integer_val is val_1
      break;
      ...
     case val_n:
      // code to execute if integer_val is val_n
      break;
     default:
      // code to execute if integer_val is none of the above
}

Default clause is kept optional, but is a good programming practice to include it. A default clause is been executed if none of other clauses are executed.


 Related C++ Tutorial Books
C++ Tutorials
The Function Pointer Tutorials
Optimizing C++
A Tutorial on Pointers and Arrays in C
A Tutorial on Pointers and Arrays in C
More Link » »
 
 C++ Tutorial FAQs
Sorry No Records are Available
More Link » »
 
 C++ Tutorial Interview Questions
What is a class?
What is an object?
Difference between realloc() and free()?
What is virtual class and friend class?
What do you mean by inline function?
More Link » »
 
 C++ Tutorial Articles
C++ Programming Tips
C++ PreProcessor
Large Numbers
Multiplying Large Numbers with Karatsuba`s Algorithm
Multithreading in C++
More Link » »
 
 C++ Tutorial News
News of C++ decline is an exaggeration
MSDN Magazine: Big C++ News
More Link » »


Share And Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages.
  • blinkbits
  • BlinkList
  • blogmarks
  • co.mments
  • connotea
  • del.icio.us
  • De.lirio.us
  • digg
  • Fark
  • feedmelinks
  • Furl
  • LinkaGoGo
  • Ma.gnolia
  • NewsVine
  • Netvouz
  • RawSugar
  • Reddit
  • scuttle
  • Shadows
  • Simpy
  • Smarking
  • Spurl
  • TailRank
  • Wists
  • YahooMyWeb

Previoushome Next

Keywords Control Statement, visual basic statement, visual basic control, source code control, vb net control, asp net control, control statements, visual basic net control, destination control statement, sql server statement, key control sop, javascript control statements, control statements in java, create control, control sample, control oracle, button control, control text, form control, use control, use statement, using control, control set, control excel, control msdn, control display, control report, control quality, control tutorial, control example, control programming


HTML Quizes
HTML Quiz
XHTML Quiz
CSS Quiz
TCP/IP Quiz
CSS 1.0 Quiz
CSS 2.0 Quiz
XML Quizes
XML Quiz
XSL Quiz
XSLT Quiz
DTD Quiz
Schema Quiz
XForms Quiz
XSL-FO Quiz
XML DOM Quiz
XLink Quiz
XQuery Quiz
XPath Quiz
XPointer Quiz
RDF Quiz
SOAP Quiz
WSDL Quiz
RSS Quiz
WAP Quiz
Web Services Quiz
Browser Scripting Quizes
JavaScript Quiz
VBScript Quiz
DHTML Quiz
HTML DOM Quiz
WMLScript Quiz
E4X Quiz
Server Scripting Quizes
ASP Quiz
PERL Quiz
SQL Quiz
ADO Quiz
CVS Quiz
Python Quiz
Apple Script Quiz
PL/SQL Quiz
SQL Server Quiz
.NET (dotnet) Quizes
Microsoft.Net Quiz
ASP.Net Quiz
.Net Mobile Quiz
C# : C Sharp Quiz
ADO.NET Quiz
VB.NET Quiz
VC++ Quiz
Multimedia Quizes
SVG Quiz
Flash Quiz
Media Quiz
SMIL Quiz
Photoshop Quiz
Gimp Quiz
Matlab Quiz
Gnuplot Programming Quiz
GIF Animation Quiz
Scientific Visualization Quiz
Graphics Quiz
Web Building  Quizes
Web Browsers Quiz
Web Hosting Quiz
W3C Quiz
Web Building Quiz
Web Quality Quiz
Web Semantic Quiz
Web Careers Quiz
Weblogic Quiz
SEO Quiz
Web Site Hosting Quiz
Domain Name Quiz
Java Quizes
Java Quiz
JSP Quiz
Servlets Quiz
Struts Quiz
EJB Quiz
JMS Quiz
JMX Quiz
Eclipse Quiz
J2ME Quiz
JBOSS Quiz
Programming Langauges Quizes
C Quiz
C++ Quiz
Visual Basic Quiz
Data Structures Using C Quiz
Cobol Quiz
Assembly Language Quiz
Mainframe Quiz
Forth Programming Quiz
Lisp Programming Quiz
Pascal Quiz
Delphi Quiz
Fortran Quiz
Oops Quiz
Data Ware Housing Quiz
CGI Programming Quiz
Emacs Quiz
Gnome Quiz
ILU Quiz
Soft Skills Quizes
Communication Skills Quiz
Time Management Quiz
Project Management Quiz
Team Work Quiz
Leadership Skills Quiz
Corporate Communication Quiz
Negotiation Skills Quiz
Database Quizes
Oracle Quiz
MySQL Quiz
Operating System Quizes
BSD Quiz
Symbian Quiz
Unix Quiz
Internet Quiz
IP-Masquerading Quiz
IPC Quiz
MIDI Quiz
Software Testing Quizes
Testing Quiz
Firewalls Quiz
SAP Module Quizes
ERP Quiz
ABAP Quiz
Business Warehousing Quiz
SAP Basis Quiz
Material Management Quiz
Sales & Distribution Quiz
Human Resource Quiz
Netweaver Quiz
Customer Relationship Management Quiz
Production and Planning Quiz
Networking Programming Quizes
Corba Quiz
Networking Quiz
Microsoft Office Quizes
Microsoft Word Quiz
Microsoft Outlook Quiz
Microsoft PowerPoint Quiz
Microsoft Publisher Quiz
Microsoft Excel Quiz
Microsoft FrontPage Quiz
Microsoft InfoPath Quiz
Microsoft Access Quiz
Accounting Quizes
Financial Accounting Quiz
Managerial Accounting Quiz
Computer Basics Quizes
Basics of Computer Quiz
Copyright © 2008. Academic Tutorials.com. All rights reserved Privacy Policies | About Us
Our Portals : Academic Tutorials | Best eBooksworld | Beyond Stats | City Details | Interview Questions | Discussions World | Excellent Mobiles | Free Bangalore | Give Me The Code | Gog Logo | Indian Free Ads | Jobs Assist | New Interview Questions | One Stop FAQs | One Stop GATE | One Stop GRE | One Stop IAS | One Stop MBA | One Stop SAP | One Stop Testing | Quick2Host | Quick2Host Mirror | Quick Site Kit | Sirf Dosti | Source Codes World | Tasty Food | Tech Archive | Testing Interview Questions | Tests World | The Galz | Top Masala | Vyom | Vyom eBooks | Vyom International | Vyom Links | Vyoms | Vyom World
Copyright © 2003-2008 Vyom Technosoft Pvt. Ltd., All Rights Reserved.