Skip to content

arya-shahi/Data_types

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Data Types

Experiment 2

Aim: To examine and verify different data types of CPP.

Theory

Data types are essential in programming, defining the kind of data that can be stored and used within a program.

Data Types:

Primitive data types are the most basic, built-in types provided by programming languages for storing simple values.

1. Integer (int): Whole number

Example: int a = 77;

2. Float: A single-precision floating-point number.

Example: float x = 3.9;

3. Double: A double-precision floating-point number.

Example: double a = 3.444555;

4. Char: Represents a single character.

Example: char initial = 'L';

5. Boolean: Represents true or false values.

Example: bool isStudent = true;

6. String Types:

String: Represents a sequence of characters. Example: string name = "Harison";

Algorithm

  • Begin

  • Include the Necessary Headers

  • Include the header files <string> and <iostream> for string and I/O operations. Use the standard namespace.

  • Declare variables of various data types: int, float, char, bool, string, and double.

  • Input and Output Operations

  • For each variable:

    • Prompt the user to enter a value.
    • Read the input value.
    • Output the size of the variable using the sizeof operator.
  • End

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages