Data Types

Data_Types.cpp

#include <bits/stdc++.h>
using namespace std;

int main() {
    // Integer types
    int i = 10; // int
    long l = 1005; // long
    long long ll = 10000005; // long long

    // Floating-point types
    float f = 10.5; // float
    float fi = 10; // float (integer value)

    double d = 1005.5; // double
    double di = 1005; // double (integer value)

    // String input and output
    string s1, s2;
    cin >> s1 >> s2;
    cout << "Print normal string: " << endl;
    cout << "s1: " << s1 << ", and s2: " << s2 << endl << endl;

    // Reading a line of text
    string str;
    getline(cin, str);
    cout << "Print getline string: " << endl;
    cout << "str: " << str;

    // Character types
    char ch = 'A'; // char
    string s = "A"; // string containing a single character

    return 0;
}

Input: Akash Singh
Output: Print normal string:
s1: Akash, and s2: Singh

Input: My Name is Akash Singh.
Output: Print getline string:
str: My Name is Akash Singh.

Data_Types.py

# Integer variables
i = 10  # An integer variable i with the value 10
l = 1005  # A long integer variable l with the value 1005
ll = 10000005  # A long long integer variable ll with the value 10000005

# Floating-point variables
f = 10.5  # A float variable f with the value 10.5
fi = 10  # Another float variable fi with the value 10 (integer value)

d = 1005.5  # A double variable d with the value 1005.5
di = 1005  # Another double variable di with the value 1005 (integer value)

# String input and output
s1 = input()  # Read a string into s1 from user input
s2 = input()  # Read another string into s2 from user input
print("Print normal string: ")
print("s1:", s1, ", and s2:", s2)
print()

# Reading a line of text
str = input()  # Read a line of text into the variable str from user input
print("Print getline string: ")
print("str:", str)

# Character variables
ch = 'A'  # A character variable ch with the value 'A'
s = "A"  # A string variable s containing the character 'A'

Input: Akash
Singh
Output: Print normal string:
s1: Akash, and s2: Singh

Input: My Name is Akash Singh.
Output: Print getline string:
str: My Name is Akash Singh.