Saturday, 12 October 2013

C++ course(tenth section)

C++ course(tenth section)

C++(etenth section)tenth section(Arrays)One dimensional arrayArray: is a collection of a fixed number of components wherein all of the components have the same data typeOne-dimensional array - an array in which the components are arranged in a list form The general form of declaring a one-dimensional array is: dataType arrayName[intExp]; where intExp is
C++ course(ninth section)

C++ course(ninth section)

C++(tninth section)ninth section(user-defined data types,and the "string" type)Enumeration Type Data type - a set of values together with a set of operations on those valuesTo define a new simple data type, called enumeration type, we need three things:−A name for the data type−A set of values for the
C++ course(eighth section)

C++ course(eighth section)

C++ course(eighth section)eighth section(Function with parameters)Function definition syntax: void functionName(dataType& variable, dataType& variable, …){statements}Value Parameter - a formal parameter that receives a copy of the content of the corresponding actual parameter Reference Parameter - a formal parameter that receives the location (memory address) of the corresponding actual parameter. Formal Parameters
Programming Example

Programming Example

Example about using functions: // A value returned by a return statement in a function#include <iostream>using namespace std;int funcRet1(void); int funcRet2();int funcRet3(); int funcRet4(int z);  int main(){  int num = 4;cout<<"Line 1: Value returned by funcRet1: "<<funcRet1()<<endl; // Line 1cout<<"Line 2: Value returned by funcRet2: "<<funcRet2()<<endl; // Line
C++ course(seventh section)

C++ course(seventh section)

C++ course(seventh section) seventh section(Functions)What is a function ?Functions are like building blocksThey allow complicated programs to be divided into manageable pieces.Some of the advantages of functions are: A programmer can focus on just that part of the program and construct it, debug it, and perfect it Different people can work
C++ course (sixth section)

C++ course (sixth section)

C++ course(sixth section)Break & Continue Statements A break and continue statement alters the flow of control The break statement, when executed in a switch structure, provides an immediate exit from the switch structure The break statement can be used in while, for, and do...while loops When the break statement executes in
C++ course(fifth section 2)

C++ course(fifth section 2)

C++ course(fifth section 2)Fifth section(continued  Loops)The for loop executes as follows:The initial statement executesThe loop condition is evaluatedif the loop condition evaluates to trueexecute the for loop statementexecute the update statement (the third expression in the parentheses)Repeat the previous step until the loop condition evaluates to falseThe initial
C++ course (fifth section 1)

C++ course (fifth section 1)

C++ course(fifth section 1)Fifth section(counter control structures 1)Why do we use repetition ? Repetition allows you to efficiently use variablesCan input, add, and average multiple numbers using a limited number of variablesFor example, you can add five numbers together by:declaring a variable for each number, inputting the numbers
C++ course (fourth section)

C++ course (fourth section)

C++ course (fourth section)fourth section(control structures)One-Way (if) Selection The syntax of one-way selection is:if (expression)statement1;statement2;If the value of the expression is true the statement1 is executedIf the value is false the statement1 is not executed and the computer goes on to the next statement in the program, which
Pages (4)1234

 
biz.