Sitemap
Christheena Kugadas

Christheena Kugadas

C++

C++ is a general- purpose, high level, compiler based, and object- oriented programming language.

Press enter or click to view image in full size
let’s learn about C++, simply😉

………………………………..THE OVERVIEW…………………………………….

. basic introduction of c++

. introduction of declaring memory location

. fundamental introduction about C++data type

uh….. cool,,, in here you will get basic knowledge about c++❤

— — — — — — — — — — — — — —

basic introduction of c++✨

— — — — — — — — — — — — — —

C++ is a cross-platform language that can be used to create high-performance applications. C++ was developed by Bjarne Stroustrup, as an extension to the C language. C++ gives programmers a high level of control over system resources and memory.

Press enter or click to view image in full size
Bjarne Stroustrup❤

— — — — — — — — — — — — — — — — — — — — — — — -

Introduction of declaring memory location✨

— — — — — — — — — — — — — — — — — — — — — — — -

In the c++ programming language, data type is the popular thing when we declaring memory location for store the variable or named constant’s value. Then only the memory will allocated the space based on the data type. In addition memory is used essentially also. In here memory management is the important thing when we enroll into programming.

When we declare memory location, we need to consider specially two things:

1. Data type

2. Assign name (identifier)

datatype identifier;  //example:
int mark;

If you declare the memory location as named constant ,then you need to consider initial value also

datatype identifier = initial value; 

//example:
float pi=3.14;

Variable…..

int sum; //declare variable

// here we can change the value during runtime

Named constant….

int sum=10; //declare named constant

//we cannot change the value during runtime. Its fixed

— — — — — — — — — — — — — — — — — — —

Introduction about C++Data type✨

— — — — — — — — — — — — — — — — — — —

A variable in programming language must be a specified data type. According to that C++ has two kind of data type such as fundamental data type and user defined data type.

Let’s see about data type in deeply.

fundamental data types

The basic (fundamental) data types provided by c++ are integral, floating point and void data type. Among these data types, the integral and floating-point data types can be preceded by several type modifiers. These modifiers (also known as type qualifiers) are the keywords that alter either size or range or both of the data types.

1.int

2.float

3.double

4.character

5.bool

6.short

User defined data type

These data types are defined by the user itself. Like, as defining a class in C++ or a structure. C++ provides the following user-defined datatypes

Get Christheena Kugadas’s stories in your inbox

Join Medium for free to get updates from this writer.

1.string

1)Fundamental data type:6

— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —

i. integer(int)

its used to store the whole numbers without decimal. (memory required-4bytes)

example:1

# include <iostream>using namespace std;int main(){ int mynum; // declare variable mynum=10; // assign the value to variable cout<<"mynum:"<<mynum; //display variable return 0;}

— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —

ii. float

stores fractional numbers, containing one or more decimals.sufficiant for storing 7decimal digits. (memory required-4bytes)

example:2

include <iostream>using namespace std;int main(){  float area; // declare variable  area=43.8512; // assign the value to variable  cout<<”area:”<<area; //display variable  return 0;}

— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —

iii. double

stores fractional numbers, containing one or more decimals. sufficient for storing 15 decimal digits. (memory required-8bytes)

example:3

# include <iostream>using namespace std;int main(){ double average; // declare variable average=52.8512; // assign the value to variable cout<<”average:”<<average; //display variablereturn 0;}

— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —

iv. character(char)

store a single character or letter or number or ASCII value. here the values want to indicate into single quotes(‘ ’). (memory required-1bytes)

example:4

# include <iostream>using namespace std;int main(){  char grade, range, a;//declare variables  grade=’A’; //assign value to variable  range=’5'; //assign value to variable  a=65; //assign value to variable  cout<<”grade:”<<grade<<endl; //return single letter  cout<<”range:”<<range<<endl; //return single number  cout<<”a:”<<a; // return ASCII value  return 0;}

— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —

v. Boolean(bool)

stores “true” or “false” value. if a statement will be ‘true’ then the output will be ‘1’ and otherwise ‘0’. (memory required-1bytes)

example:5

# include <iostream>using namespace std;int main(){ bool a=true; //declare named constant bool b=false; //declare named constant cout<<a<<endl; //return 1 cout<<b; //return 0 return 0;}

— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —

vi. short

its used to store small integers, between -32,768 to 32,767. (memory required-2bytes)

example:6

# include <iostream>using namespace std;int main(){short value1,value2; //declare variables value1=12365; //assign the value value2=32769; cout<<”value1:”<<value1<<endl; // return 12365 cout<<”value2:”<<value2; // return -32769 return 0;}

— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —

2)user- defined data type:1

i. string

zero or more characters or text. Here the value indicates with double quotes(“ ”). (memory required-1byte per character)

example:7

# include <iostream>using namespace std;int main(){ string text=”Welcome to my medium page”; // declared named constant cout<<text; // return Welcome to my medium pagereturn 0;}
Press enter or click to view image in full size
Thank you ❤. I hope that you got the idea✨✨✨