Monday, 17 April 2023

Data Types in C++ with Examples

 Integer

Integer data types are used to store only numeric data that is numbers they don’t have any fractional component itself.



Example:-

#include <iostream>

using namespace std;

int main()

{

int num_value = 10;

cout << num_value;

return 0;

}

Float

Floating point types include all types in which a number may have a fractional component, such as 3.14 or pi.

Example:-

#include <iostream>

using namespace std;

int main()

{

float float_value = 10.55;

cout << float_value;

return 0;

}

Character

Most modern computer programming languages store alphabets, characters by representing each one using a small piece of numeric code.

Example:-

#include <iostream>

using namespace std;

int main()

{

char char_value = 'T';

cout << char_value;

return 0;

}

String

Most modern computer programming languages ​​have a means of representing strings, which are collections of characters such as words and sentences, and perform manipulation operations on data for various purposes.

Example:-

#include <iostream>

#include <string>

using namespace std;

int main()

{

string str_value = "TCCI";

cout << str_value;

return 0;

}

Array

Arrays which are collections of data elements all having the same data type, so the execution becomes easy performing some operation on index value.

Example:-

#include <iostream>

using namespace std;

int main()

{

int arr_value[] = {10, 20, 30, 40, 50};

cout << arr_value[0] << endl;

cout << arr_value[1] << endl;

cout << arr_value[2] << endl;

cout << arr_value[3] << endl;

cout << arr_value[4] << endl;

return 0;

}

C++ contains following topics at TCCI:

Introduction to C++, Basic Syntax, Object Oriented Concept, Data Types and Variables, Constants, Literals, Modifiers, Operators, Loop Controls, Decision Making, Class Structure with Object, Function, Arrays, String, Inheritance, Constructor-Destructor, Exception Handling, Files etc.

Course Duration: Daily/2 Days/3 Days/4 Days

Class Mode: Theory With Practical

Learn Training: At student’s Convenience

For More Information:                                    

Call us @ +91 9825618292

Visit us @ http://tccicomputercoaching.com

No comments:

Post a Comment