Skip to content

akshitbansal2005/Data-Types-CPP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

Data Types

Experiment 2

Objective: To examine and verify different data types.

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 = 2;

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

Example: float x = 5.9;

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

Example: double a = 5.97585858;

4. Char: Represents a single character.

Example: char initial = 'A';

5. Boolean: Represents true or false values.

Example: bool isStudent = true;

6. String Types:

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

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