C is an imperative, procedural language in the ALGOL tradition. It has a static type system. In C, all executable code is contained within subroutines (also called "functions", though not in the sense of functional programming). Function parameters are passed by value, although arrays are passed as pointers, i.e. the address of the first item in the array. Pass-by-reference is simulated in C by explicitly passing pointers to the thing being referenced.
C program source text is free-format, using the semicolon as a statement separator and curly braces for grouping blocks of statements.
The C language also exhibits the following characteristics:
The language has a small, fixed number of keywords, including a full set of control flow primitives: if/else, for, do/while, while, and switch. User-defined names are not distinguished from keywords by any kind of sigil.
It has a large number of arithmetic, bitwise, and logic operators: +,+=,++,&,||, etc.
More than one assignment may be performed in a single statement.
in the oops concept convey to learn the contents are objects and classes, function in c++, and control structure. it can be easily learn to the concept with in the example of simple
program i have easy to learn for attached the program it can be very useful for student
C is an imperative, procedural language in the ALGOL tradition. It has a static type system. In C, all executable code is contained within subroutines (also called "functions", though not in the sense of functional programming). Function parameters are passed by value, although arrays are passed as pointers, i.e. the address of the first item in the array. Pass-by-reference is simulated in C by explicitly passing pointers to the thing being referenced.
C program source text is free-format, using the semicolon as a statement separator and curly braces for grouping blocks of statements.
The C language also exhibits the following characteristics:
The language has a small, fixed number of keywords, including a full set of control flow primitives: if/else, for, do/while, while, and switch. User-defined names are not distinguished from keywords by any kind of sigil.
It has a large number of arithmetic, bitwise, and logic operators: +,+=,++,&,||, etc.
More than one assignment may be performed in a single statement.
in the oops concept convey to learn the contents are objects and classes, function in c++, and control structure. it can be easily learn to the concept with in the example of simple
program i have easy to learn for attached the program it can be very useful for student
it is written in a very simple language.generally ,it will help students of first year to achieve success in this language . one can easily score good marks after reading from this note.
Are you searching for C Language Training in Ambala? Noe tour search ends here.... Batra Computer Centre provides you the best training in C Language in Ambala. Btra Computer Centre offers you many other courses like Basic Computer Course, C& C++, SEO, Web Designing , Web Development and many more...
it is written in a very simple language.generally ,it will help students of first year to achieve success in this language . one can easily score good marks after reading from this note.
Are you searching for C Language Training in Ambala? Noe tour search ends here.... Batra Computer Centre provides you the best training in C Language in Ambala. Btra Computer Centre offers you many other courses like Basic Computer Course, C& C++, SEO, Web Designing , Web Development and many more...
Palestine last event orientationfvgnh .pptxRaedMohamed3
Â
An EFL lesson about the current events in Palestine. It is intended to be for intermediate students who wish to increase their listening skills through a short lesson in power point.
Read| The latest issue of The Challenger is here! We are thrilled to announce that our school paper has qualified for the NATIONAL SCHOOLS PRESS CONFERENCE (NSPC) 2024. Thank you for your unwavering support and trust. Dive into the stories that made us stand out!
The Indian economy is classified into different sectors to simplify the analysis and understanding of economic activities. For Class 10, it's essential to grasp the sectors of the Indian economy, understand their characteristics, and recognize their importance. This guide will provide detailed notes on the Sectors of the Indian Economy Class 10, using specific long-tail keywords to enhance comprehension.
For more information, visit-www.vavaclasses.com
Honest Reviews of Tim Han LMA Course Program.pptxtimhan337
Â
Personal development courses are widely available today, with each one promising life-changing outcomes. Tim Hanâs Life Mastery Achievers (LMA) Course has drawn a lot of interest. In addition to offering my frank assessment of Success Insiderâs LMA Course, this piece examines the courseâs effects via a variety of Tim Han LMA course reviews and Success Insider comments.
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxEduSkills OECD
Â
Andreas Schleicher presents at the OECD webinar âDigital devices in schools: detrimental distraction or secret to success?â on 27 May 2024. The presentation was based on findings from PISA 2022 results and the webinar helped launch the PISA in Focus âManaging screen time: How to protect and equip students against distractionâ https://www.oecd-ilibrary.org/education/managing-screen-time_7c225af4-en and the OECD Education Policy Perspective âStudents, digital devices and successâ can be found here - https://oe.cd/il/5yV
Unit 8 - Information and Communication Technology (Paper I).pdfThiyagu K
Â
This slides describes the basic concepts of ICT, basics of Email, Emerging Technology and Digital Initiatives in Education. This presentations aligns with the UGC Paper I syllabus.
Instructions for Submissions thorugh G- Classroom.pptxJheel Barad
Â
This presentation provides a briefing on how to upload submissions and documents in Google Classroom. It was prepared as part of an orientation for new Sainik School in-service teacher trainees. As a training officer, my goal is to ensure that you are comfortable and proficient with this essential tool for managing assignments and fostering student engagement.
The Art Pastor's Guide to Sabbath | Steve ThomasonSteve Thomason
Â
What is the purpose of the Sabbath Law in the Torah. It is interesting to compare how the context of the law shifts from Exodus to Deuteronomy. Who gets to rest, and why?
2024.06.01 Introducing a competency framework for languag learning materials ...Sandy Millin
Â
http://sandymillin.wordpress.com/iateflwebinar2024
Published classroom materials form the basis of syllabuses, drive teacher professional development, and have a potentially huge influence on learners, teachers and education systems. All teachers also create their own materials, whether a few sentences on a blackboard, a highly-structured fully-realised online course, or anything in between. Despite this, the knowledge and skills needed to create effective language learning materials are rarely part of teacher training, and are mostly learnt by trial and error.
Knowledge and skills frameworks, generally called competency frameworks, for ELT teachers, trainers and managers have existed for a few years now. However, until I created one for my MA dissertation, there wasnât one drawing together what we need to know and do to be able to effectively produce language learning materials.
This webinar will introduce you to my framework, highlighting the key competencies I identified from my research. It will also show how anybody involved in language teaching (any language, not just English!), teacher training, managing schools or developing language learning materials can benefit from using the framework.
3. Identifiers is a name given to programming elements such as
variables, functions, arrays, objects, classes, etc.,
ī¯ The following are some valid identifiers:
Student Reg101 a1e2r3
creating identifiers:
_dos
ī¯ Rules to be followed while
īŧ Identifiers are a sequence of characters which should begin with
the alphabet either from A-Z (Uppercase) or a-z (lowercase) or
(underscore).
īŧ C++ treats uppercase and lowercase characters differently
īŧ No Special character is allowed except underscore â_â.
īŧ Identifier should be single words i.e. blank spaces cannot be
included in identifier.
īŧ Reserved Keywords should not be used as identifiers.
īŧ Identifiers should be of reasonable length.
_
15
Identifiers
5. .
ī¯ C++ Operators:
īŧ Operators are used to perform operations on variables
values.
īŧ Example: int x = 100 + 50;
ī¯ C++ Operators Types:
and
īŧ C++ divides the operators into
ī¯ Arithmetic operators
ī¯ Assignment operators
ī¯ Comparison operators
ī¯ Logical operators
ī¯ Bitwise operators
the following groups.
22
C++ Operators
6. ī¯ Arithmetic operators are used to perform common
mathematical operations.
23
Arithmetic Operators
8. ī¯ Comparison operators are used to compare two values.
ī¯ The return value of a comparison is either true (1) or false (0).
25
Relational Operator
9. ī¯ Logical operators are used to determine the logic between
variables or values.
26
Logical Operators
10. ī¯ A Bitwise operators
programming.
are used in bit level
27
Bitwise Operators
11. 28
ī¯ Operators may also be classified
operands they act on either:
īŧ Unary Operators
īŧ Example: a++
īŧ Binary Operators
īŧ Example: x = yâ z;
on the number of
C++ Operators
12. Special Operator :
ī¯ An expression is a combination of opcode and operand.
ī¯ Some special operators used in C++ programming are:
29
C++ Operators
13. ī¯ Punctuators in C++ have syntactic and semantic meaning
to the compiler.
30
Punctuators
14. Data Types:
ī¯ Data Types can be defined as the set of values, which can be
stored in a variable along with the operations that can be
performed on those values.
ī¯ C++ defines several types of data and each type has
characteristics.
ī¯ C++ data types can be classified as:
unique
1.
2.
3.
The fundamental data type(built-in
Derived Data type
User-defined data type
data)
31
Data Types
15. Data Types:
ī¯ C++ defines several types of data and
characteristics.
each type has unique
ī¯ C++ data types can be classified as:
32
Data Types
16. Input & Output Operators
ī¯ The input output operations are done using library functions
cin and cout objects of the class iostream.
ī¯ Using the standard input and output library, we will able to
interact with the user by printing message on the screen and
getting the userâs input from the keyboard.
īŧ A stream is an object where a program can either
insert/extract characters to/from it.
īŧ The standard C++ library includes the header file iostream,
where the standard input and output stream objects are
declared.
35
Input & Output Operators
17. Input Operators:
ī¯ Input Operator â>>â: The standard input device is usually the
keyboard.
ī¯ Input in C++ is done by using the
the cin stream.
âstream extractionâ (>>) on
ī¯ âcinâ stands for âconsole inputâ.
ī¯ Example: int age;
cin>>age;
36
Input & Output Operators
18. Output Operator:
ī¯ Output Operator â<<â: The standard output device is the
screen (Monitor).
ī¯ Outputting in C++ is done by using the object followed by
âstream insertionâ (<<).
ī¯ âcoutâ stands for console output
the
ī¯ Example: cout<<âsumâ; //prints sum
cout<<sum; //prints the content of the variable sum;
37
Input & Output Operators
19. Cascading of I/O Operators:
ī¯ If a program requires more than
possible to input these variables
multiple stream extraction â>>â
one input variable then it is
in a single cin statement using
operators.
ī¯ Example: cout<<âEnter the two numberâ;
cin>>a>>b;
ī¯ If a program requires more than one output result then this can
be done using a single cout statement with multiple stream
insertion â<<â operators.
ī¯ This is called cascading of input & output operators.
ī¯ Example: cout<<âEntered the two numberâ<<a<<b<<endl;
cout<<âThe sum of two number isâ<<sum<<endl;
38
Input & Output Operators
20. Introduction:
ī¯ Control statements are statements that alter the sequence
of flow of instructions.
ī¯ The order in which statements are executed in a program
is called flow of control.
ī¯ Types of control statements:
control statements.
īŧ Selection statements
īŧ Iteration statements
C++ supports two basic
41
Control Statements
21. Selection Statements:
This statement allows us to select a statement or set of
statements for execution based on some condition.
It is also known as conditional statement.
ī¯
ī¯
This structure helps the programmer
decision.
The different selection statements:
īŧ if statement
īŧ if â else statement
īŧ Nested â if statement
īŧ switch statement
to take appropriate
ī¯
ī¯
42
Control Statements
22. .:
43
if
ī¯
statement:
This
This
This
is the simplest form of Selection statement.
statement is also called as one-way branching.
statement is used to decide whether a statement
ī¯
or
ī¯
set of statements should be executed
The decision is based on a condition
evaluated to TRUE or FALSE
Syntax:
if (Test Condition) // is true
Statement 1;
Statement 2;
or not.
which can be
ī¯
ī¯
Selection Statements
23. if
ī¯
â else statement:
This statement is also called as two-way branching.
This structure helps to select one
executed from two sets.
set of statements to be
ī¯
Syntax of if â else
if (Test Condition)
statement is:
ī¯
Statement 1;
else
Statement 2;
44
Selection Statements
24. Nested if statement :
ī¯ If the statement of an if statement is another if statement
then such an if statement is called as Nested-if Statement.
ī¯ The general form of
if (Test Condition 1)
Statement 1;
else if (Test Condition 2)
Statement 2;
else
âĻâĻâĻ..
else if( test Condition N)
Statement N;
else Default Statement;
if â else â if statement is:.
45
Selection Statements
25. Switch Statement :
ī¯ C++ has built in multiple-branch selection statement
ī¯ If there are more than two alternatives to
selection construct is used.
be selected, multiple
ī¯ The general form of Switch statement
Switch ( Expression )
is:
{ Case Label-1: Statement 1;
Break;
Case Label-2: Statement 1;
Break;
âĻâĻâĻâĻ..
Case Label-N: Statement N;
Break;
Default : Default- Statement;
} 46
Selection Statements
26. Iterative Constructs or Looping:
ī¯ The process of repeated execution of a sequence of
statements until some condition is satisfied is called as
iteration or loop.
ī¯ Iterative statements are also called as repetitive statement
or looping statements.
ī¯ There are three types
īŧ while loop
īŧ do while loop
īŧ for loop
of looping structures in C++:
47
Iteration statements
27. while loop:
ī¯ This is a pre-tested loop structure.
ī¯ This structure checks the condition at the beginning of the
structure.
ī¯ The set of statements are executed again
the condition is true.
and again until
ī¯ The general form of while
while ( Test Condition)
structure is
{ Statement
Statement
âĻâĻ..
Statement
1
2
N
} //End of While 48
Iteration statements
28. do-while loop:
ī¯ This is a post-tested loop structure.
ī¯ This structure checks the condition at the end of the structure.
ī¯ The set of statements are executed again
condition is true.
and again until the
ī¯ The general form
do
of while structure is
{ Statement
Statement
âĻâĻ..
Statement
1
2
N
} //while ( Test Condition);
49
Iteration statements
29. for loop:
ī¯ This structure is the fixed execution structure.
ī¯ Usually used when we know in advance exactly how
many times a set of statements to be executed repeatedly.
ī¯ This structure can be used as increment looping
decrement looping structure.
or
ī¯ The general form of for structure is as follows:
for ( Expression 1; Expression 2; Expression 3)
{ Statement
Statement
Statement
1;
2;
N;
}
50
Iteration statements
30. Introduction:
ī¯ An array is collection of elements where all the elements are
same data type under the same name.
ī¯ The elements are numbered as 0, 1, 2âĻ.n-1.
ī¯ These numbers called as indices or subscripts.
ī¯ These numbers are used to locate the positions of elements
within the array.
ī¯ If a is the name of
accessed as
a[0], a[1],
the array, the elements can be directly
a[2],âĻâĻ, a[n-1].
56
Arrays
31. .
ī§Why need to use array type?
ī§Consider the following issue:
"We have a list of 1000 students' marks of
an integer type. If using the basic data
type (int), we will declare something like
the followingâĻ"
int studMark0, studMark1, ...studMark999
32.
33.
34.
35.
36.
37.
38.
39. #include<iostream>
using namespace std;
int main()
{
int i,sum=0,a[5];
cout<<"enter Numbers ";
for(i=0;i<5;i++)
{
cin>>a[i];
}
for(i=0;i<5;i++)
{
sum=sum+a[i];
}
cout<<" Sum= "<<sum;
return 0;
}
40. #include<iostream>
using namespace std;
int main()
{
int i,a[5],max, min;
cout<<"enter value ";
for(i=0;i<5;i++)
{
cin>>a[i];
}
max=a[0];
min=a[0];
for(i=1;i<5;i++)
{
if(max<a[i])
max=a[i];
if(min>a[i])
min=a[i];
}
cout<<" max="<<max<<endl;
cout<< " min ="<<min<<endl;
return 0;
}
41.
42.
43. Introduction:
ī¯ A function is a named group of statements developed to solve
a sub-problem and returns a value to other functions when it is
called.
ī¯ Types of functions:
īŧ Library functions
A standard library is a collection of pre-defined functions and
other programming elements, which are accessed through
header files
īŧ User-defined functions
ī¯
We can create our own functions or sub-programs to solve our
problem. Such functions are normally referred to as user-
defined functions
ī¯
58
Functions
44. User-defined functions:
User-defined function is a function defined by the user to solve
his/her problem.
The purpose of using a function is to make the program design
process easy, understandable and thereby avoiding ambiguity.
Types of functions:
ī¯
ī¯
ī¯
īŧ Function
īŧ Function
īŧ Function
īŧ Function
with
with
with
with
no arguments and no return values.
arguments and with no return values.
no arguments and with return values.
arguments and with return values.
īŧ Recursive function.
59
Functions
45.
46.
47.
48.
49.
50. Function with no argument and no return
#include<iostream>
using namespace std;
void sum();
int main()
{
sum();
return 0;
}
void sum()
{
int a,b;
cout<<" enter a and b :- ";
cin>>a>>b;
cout<<" Sum="<<a+b;
}
51. Function with argument and no return
#include<iostream>
using namespace std;
void sum(int, int);
int main()
{
int a,b;
cout<<" enter a and b :- ";
cin>>a>>b;
sum(a,b);
return 0;
}
void sum(int a, int b)
{
cout<<" Sum="<<a+b;
}
52. Function with no argument and return
#include<iostream>
using namespace std;
int sum();
int main()
{
int x;
x=sum();
cout<<" Sum="<<x;
return 0;
}
int sum()
{
int a,b;
cout<<" enter a and b :- ";
cin>>a>>b;
return(a+b);
}
53. Function with argument and return
#include<iostream>
using namespace std;
int sum(int, int);
int main()
{
int x,a,b;
cout<<" enter a and b :- ";
cin>>a>>b;
x=sum(a,b);
cout<<" Sum="<<x;
return 0;
}
int sum(int a, int b)
{
return(a+b);
}
54. ī¯ Objects are basic building blocks for designing programs.
ī¯ An object is a collection of data members and associated
member functions.
ī¯ An object may represent a person, place or a table of data.
ī¯ Each object is identified by a unique name. Each object
must be a member of a particular class.
62
Objects
55. ī¯ A class is a collection of objects that have identical
properties, common behavior and shared relationship.
ī¯ A class binds the data and its related functions together.
ī¯ A class is a user-defined data type that we
program.
can use in a
ī¯ To create a class, use the
ī¯ Example:
class MyClass
{
// The class body
};
class keyword.
īŧ Where class keyword is used to create a class called MyClass
63
Class
56. Definition and Declaration of Classes
ī¯ A class definition is a process of naming a class and data
variables, and interface operation of the class.
ī¯ The variables declared inside a class are known as data
members.
ī¯ The functions declared inside a class are known as member
functions.
ī¯ A class declaration specifies the representation of objects of
the class and set of operations that can be applied to such
objects.
64
Class in C++
57. Definition and Declaration of Classes
ī¯ Class body is enclosed in a pair of brackets. Class body
contains the declaration of its members (data and functions).
ī¯ The functions declared inside a class are known
functions.
as member
ī¯ The general syntax of the class declaration
class User_Defined_Name
{
private :
Data Member;
Member functions;
};
is:
65
Class in C++
58. Access Specifiers
Access specifiers define how the members (attributes and
function) of a class can be accessed.
ī¯
Every data member of a class is specified by three levels
access protection for hiding data and function members
internal to the class.
of
ī¯
They help in controlling the access
Different access specifiers are:
īŧ private
īŧ public
īŧ protected
of the data members.
ī¯
ī¯
66
Access Specifiers
59. private:
ī¯ private access means a member data can only be accessed by
the class member function or friend function.
ī¯ The data members or member functions declared private
cannot be accessed from outside the class.
ī¯ The objects of the class can access the private members
through the public member functions of the class.
ī¯ By default data members in a class are private.
ī¯ Example:
private:
int x;
float y;
only
67
Access Specifiers
60. protected:
ī¯ The members which are declared using protected can be
accessed only by the member functions, friend of the class
also the member functions derived from this class.
ī¯ The members cannot be accessed from outside the class.
and
ī¯ The protected access
specifiers.
ī¯ Example:
protected:
int x;
float y;
specifier is similar to private access
68
Access Specifiers
61. public:
ī¯ public access means that member can be accessed any function
inside or outside the class.
ī¯ Some of the public functions of a class provide interface for
accessing the private and protected members
ī¯ Example:
class MyClass
{
public: // Public access specifier
of the class.
int x;
private:
int y;
};
// Public attribute
// Private access specifier
// Private attribute
69
Access Specifiers
62. Member Function:
ī¯ Member functions are functions that are included
within a class (Member functions are also called
Methods).
ī¯ Member functions can be defined
īŧ Inside class definition
īŧ Outside class definition
in two places.
70
Member Function
63. Inside class definition:
ī¯ To define member function inside a class the function declaration
within the class is replaced by actual function definition inside
class.
the
ī¯ Only small functions are
ī¯ Example:
class rectangle
{
defined inside class definition.
void compute( )
{
area = length * breadth;
}
void display( )
{
int length, breadth,
public:
void get_data( )
{
area;
cout<< â Enter the values for Length and
Breadthâ;
cin>>length>>breadth;
}
cout<<â The area of rectangle isâ<<area;
}
};
71
Member Function
64. Outside class definition:
ī¯ To define member function outside the class, the class name
must be linked with the name of member function.
ī¯ Scope resolution operator (::) is used to define the member
function outside the class.
ī¯ Syntax of a member function defined outside the class is:
return_type class_name : : member_function_name( arg1, ..., argnN)
{
function body;
}
72
Member Function
65. Program to use member
class definition:
#include<iostream.h>
class item
{
private:
int numbers;
float cost;
public:
functions inside and outside
};
void item : : getdata(int a, float b)
{
number = a;
cost = b;
}
void getdata(int a,
void putdata( )
{
cout<<âNumber:
float b); int main( )
{
item x;
x. getdata( 250, 10.5);
x.putdata( );
return 0;
}
â<<number<<endl;
cout<<âCost:â<<cost<<endl;
}
73
Member Function
66. Object of a class:
ī¯ An object is a real world element which is identifiable entity
with some characteristics (attributes) and behavior (functions).
ī¯ An object is an instance of a class.
ī¯ An object is normally defined in the main ( ) function.
ī¯ The syntax for defining objects of a class as follows:
class Class_Name
{
private : //Members
public : //Members
};
class Class_Name Object_name1, Object_name2,âĻâĻ;
īŧ where class keyword is optional.
74
Defining object of a class
67. Dot operator (.):
ī¯ The public data members of objects of a class can be accessed
using direct member access operator (.).
ī¯ Private and protected members of the class can be accessed
only through the member functions of the class.
ī¯ No functions outside a class can include statements to access
data directly.
ī¯ The syntax of accessing member (data and functions) of a class
is:
a) Syntax for accessing a data member of the class:
Object_Name . data_member;
b) Syntax for accessing a member function of the class:
Object_Name . member_function(arguments); 75
Accessing member of the class