67% found this document useful (21 votes)
10K views14 pages

C and C++ Summer Internship Report

The document summarizes a training report submitted by a student on their summer training in C and C++. It provides details of the modules covered during training including topics on C language like variables, data types, operators, control statements, functions etc. It also describes topics on C++ like classes, objects, constructors, destructors etc.

Uploaded by

raj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
67% found this document useful (21 votes)
10K views14 pages

C and C++ Summer Internship Report

The document summarizes a training report submitted by a student on their summer training in C and C++. It provides details of the modules covered during training including topics on C language like variables, data types, operators, control statements, functions etc. It also describes topics on C++ like classes, objects, constructors, destructors etc.

Uploaded by

raj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
You are on page 1/ 14

TRAINING REPORT

C and C ++ Summer Training

Submitted By

Name :- MANISH SAMRAT


Registration No.:- 19103132905

Branch :- Electrical Engineering(EE)


Semester:- 5th

Submitted To:-
Department of EE
Saharsa College of Engineering
Saharsa
Index of report

1. Acknowledgement
2. Abstract
3. Certificate
4. Training Details (with topics)
Module 1:
• What is C Language, History of C, First C Program
• Printf, scanf, variables, datatypes, keywords, operators
• Control statement (if, switch, conditional operator, goto, loop)
• Functions
• Array
• Pointers
• Structure, Union
• File Handling

Module 2:
• C++ Introduction
• C vs C++
• cout, cin, endl
• class and object
• Constructor
• Destructor

5. Conclusion
ACKNOWLEDGEMENT

I have taken efforts in this industrial training.


However, it would not have been possible without the
kind support and help of many individuals and
organizations. I would like to extend my sincere
thanks to all of them. A Special thanks to electrical
department for giving me the opportunity to pursue
my industrial training in the institute. I would like
to express my special gratitude and thanks to
industry persons for giving us such attention and
time.

-MANISH SAMRAT
(19103132905)
ABSTRACT

I am a student of Saharsa College of Engineering,


Saharsa and studying in EE 5th semester. As a part
of our degree we have undergone in a training process
for 4 weeks.

Present is the age of computers and technologies.


Practical knowledge has its own importance. Without
practical knowledge one cannot be specialized in one’s
field. We have automated the practical knowledge of
institutes and their working in the project.
CERTIFICATE
TRAINING CONTENT
Module 1
What is C Language
The C language is developed for creating system applications that directly interact
with the hardware devices such as drivers, kernels, etc.

C programming is considered as the base for other programming languages, that is why
it is known as mother language.

Histroy of C Language
C programming language was developed in 1972 by Dennis Ritchie at Bell
Laboratories of AT&T (American Telephone & Telegraph), located in the U.S.A.

Dennis Ritchie is known as the founder of the C Language.

First C Program
To write the first c program, open the C console and write the following code:

1. #include <stdio.h>

2. int main(){

3. printf("Hello C Language");

4. return 0;

5. }

printf() and scanf() in C


The printf() and scanf() are used for input and output in C Language. Both functions
are inbuilt library functions, defined in studio.h (header file).

Variables in C

A variable is a name of the memory location. It is used to store data. Its value can be
changed, and it can be reused many times.

It is a way to represent memory location through symbol so that it can be easily identified.

Let's see the syntax to declare a variable:

type variable_list;

The example of declaring the variable is given below:


1. int a;
2. float b;
3. char c;

Data Types in C
A data type specifies the type of data that a variables can store such as integer, floating,
character,etc.

Keywords in C
A keyword is reserved word. You cannot use it as a variable name, constant name, etc. There
are only 32 reserved words(keywords) in the C language.

Operators
An operator is a symbol that tells the compiler to perform specific mathematical or logical
functions. C language is rich in built-in operators and provides the following types of
operators −
• Arithmetic Operators

• Relational Operators

• Logical Operators

• Bitwise Operators
• Assignment Operators

Control Statement
In C, the control flows from one instruction to the next instruction until now in all programs.
This control flow from one command to the next is called sequential control flow.
Nonetheless, in most C programs the programmer may want to skip instructions or repeat a
set of instructions repeatedly when writing logic. This can be referred to as sequential control
flow. The declarations in C let programmers make such decisions which are called decision-
making or control declarations

Types of Control Statements in C

1. If statements 3. Switch Statement

2. Conditional Operator Statement

4. Goto Statement
5. Loop Statements

For loop while loop

Functions

A function declaration tells the compiler about a function's name, return type, and
parameters. A function definition provides the actual body of the function.

The general form of a function definition in C programming language is as follows −


return_type function_name( parameter list ) {
body of the function
}

Array

An array is a variable that can store multiple values. For example, if you want to store 100
integers, you can create an array for it.

int data[100];

Pointer

A pointer is a variable whose value is the address of another variable, i.e., direct address of the
memory location. Like any variable or constant, you must declare a pointer before using it to store
any variable address.

Here is how we can declare pointers.

int* p;

Structure

A structure is a user defined data type in C/C++. A structure creates a data type that can be
used to group items of possibly different types into a single type.
Before you can create structure variables, you need to define its data type. To define a struct,

the struct keyword is used.

Syntax of struct

struct structureName

dataType member1;

dataType member2;

...

};

File Handling

File handling in C refers to the task of storing data in the form of input or output produced by
running C programs in data files, namely, a text file or a binary file for future reference and
analysis.

The C programming offers various operations associated with file handling. They are:

•Creating a new file: fopen()


•Opening an existing file in your system: fopen()
•Closing a file: fclose()
•Reading characters from a line: getc()
•Writing characters in a file: putc()
•Reading a set of data from a file: fscanf()
•Writing a set of data in a file: fprintf()
•Reading an integral value from a file: getw()
•Writing an integral value in a file: putw()
•Setting a desired position in the file: fseek()
•Getting the current position in the file: ftell()
•Setting the position at the beginning point: rewind()
The following modes in which the file can be opened are:
Module 2
C++ Introduction
C++ is an object-oriented programming language. It is an extension to C programming.

C++ is a general purpose, case-sensitive, free-form programming language that supports object-
oriented, procedural and generic programming.

C++ is a middle-level language, as it encapsulates both high and low level language features.

C vs C++

C++ Basic Input/Output


C++ I/O operation is using the stream concept. Stream is the sequence of bytes or flow of data. It
makes the performance fast.

If bytes flow from main memory to device like printer, display screen, or a network connection,
etc, this is called as output operation.

If bytes flow from device like printer, display screen, or a network connection, etc to main
memory, this is called as input operation.

C++ Object and Class

Since C++ is an object-oriented language, program is designed using objects and classes in
C++.

C++ Object

In C++, Object is a real world entity, for example, chair, car, pen, mobile, laptop etc.
In other words, object is an entity that has state and behaviour. Here, state means data and
behaviour means functionality.

Object is a runtime entity, it is created at runtime.

Object is an instance of a class. All the members of the class can be accessed through object.

Let's see an example to create object of student class using s1 as the reference variable.

1. Student s1; //creating an object of Student

C++ Class

In C++, object is a group of similar objects. It is a template from which objects are created. It can
have fields, methods, constructors etc.

Let's see an example of C++ class that has three fields only.

1. class Student

2. {

3. public:

4. int id; //field or data member

5. float salary; //field or data member

6. String name;//field or data member

7. }

C++ Constructor

In C++, constructor is a special method which is invoked automatically at the time of object
creation. It is used to initialize the data members of new object generally. The constructor in C++
has the same name as class or structure.

There can be two types of constructors in C++.

o Default constructor
o Parameterized constructor

C++ Destructor

A destructor works opposite to constructor; it destructs the objects of classes. It can be defined only
once in a class. Like constructors, it is invoked automatically.

A destructor is defined like constructor. It must have same name as class. But it is prefixed with a
tilde sign (~).

Note: C++ destructor cannot have parameters. Moreover, modifiers can't be applied on destructors.
Conclusion
It is naive for an Extension professional to feel that if
information is delivered during a learning activity, the
educational mission has been accomplished. The broader
mandate that learning generate change in behaviour,
practice, or belief requires a much more sophisticated science
and art. In today's information-rich culture, Extension's
store of information no longer makes the organization
unique. Rather, Extension's organizational strength and
uniqueness lie in the experience and capability of its
professionals to motivate individuals and groups to action.

It is important for Extension educators to develop and field


test useful models for program design and delivery that
include behaviour change. It is equally important for the
models to be linked to sound educational theory that will be
valued by partnering agencies and understood by the
targeted clientele.

The process described in this article accomplished these


objectives and resulted in information that now provides a
framework for quality training in a broad range of
programming. Further development of the model has
resulted in additional insights with practical application
beyond the scope of this article.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy