xFactorSchool.com(Beta)
How to Do Examples
Python Examples
HTML Examples
Code Examples
C Code Examples
C++ Code Examples
C# Code Examples
Java Code Examples
Python Code Examples
HTML Code Examples
CSS Code Examples
JavaScript Code Examples
Online Editor
C Code Editor
C++ Code Editor
C# Code Editor
Java Code Editor
Python Code Editor
HTML Code Editor
CSS Code Editor
JavaScript Code Editor
Practice how to create different data types in C++
C++ Online Editor
Execute Code
More C++ Sample Code
#include <iostream> #include<string> // included to create string data using namespace std; // use std namespace to avoid std:: before cout int main() { char charVariable = 'A'; // Character data cout << charVariable << " is a character data" << endl; string stringVariable = "Hello World C++ "; // String data cout << stringVariable << " is a string data" << endl; const char* strVariable = "Hello C like string"; // C like string data cout << strVariable << " is a string data" << endl; int integerVariable = 10; // Integer data cout << integerVariable << " is an integer data" << endl; float floatVariable = 3.14; // Float data cout << floatVariable << " is a float data" << endl; double doubleVariable = 2.71828; // Double data cout << doubleVariable << " is a double data" << endl; int boolVariable = 1; // Boolean data (0 represents false, non-zero represents true) cout << (boolVariable ? "True" : "False") << " is a boolean data" << endl; return 0; }