Skip to content

Commit 8f45a1b

Browse files
committed
completed DataType
1 parent 4636c53 commit 8f45a1b

7 files changed

+67
-0
lines changed

DataTypes/.vscode/settings.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"files.associations": {
3+
"ostream": "cpp"
4+
}
5+
}

DataTypes/Boolean_DataType.cpp

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#include <iostream>
2+
using namespace std;
3+
4+
int main()
5+
{
6+
// bool = 1 byte
7+
bool myCondition = true; // 1
8+
cout << "The condition was " << myCondition << endl;
9+
bool myAnotherCondition = false; // 0
10+
cout << "The condition was " << myAnotherCondition << endl;
11+
}

DataTypes/Character_DataType.cpp

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#include <iostream>
2+
using namespace std;
3+
4+
int main()
5+
{
6+
// char = 1 byte
7+
char ch = 'A';
8+
cout << "The character is " << ch << endl;
9+
char ch2 = '5';
10+
cout << "The character is " << ch2 << endl;
11+
}

DataTypes/Double_DataType.cpp

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#include <iostream>
2+
#include <iomanip>
3+
using namespace std;
4+
5+
int main()
6+
{
7+
// double = 8 bytes
8+
double salaray = 50000.505;
9+
cout << setprecision(3) << fixed;
10+
cout << "The salary is " << salaray << endl;
11+
}

DataTypes/Float_DataType.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#include <iostream>
2+
using namespace std;
3+
4+
int main()
5+
{
6+
// float = 4 bytes
7+
float salaray = 50000.505;
8+
cout << "The salary is " << salaray << endl;
9+
}

DataTypes/Integer_DataType.cpp

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#include <iostream>
2+
using namespace std;
3+
4+
int main()
5+
{
6+
// int = 2 or 4 Bytes
7+
int age = 20;
8+
cout << "The age is " << age << endl;
9+
int SerialNumber = 54;
10+
cout << "The serial is " << SerialNumber << endl;
11+
}

DataTypes/WideCharacter_DataType.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#include <iostream>
2+
using namespace std;
3+
4+
int main()
5+
{
6+
// wchar_t = 2 byte
7+
wchar_t ch = L'D';
8+
cout << "The character is " << ch << endl;
9+
}

0 commit comments

Comments
 (0)