0% found this document useful (0 votes)
12 views

C++ Data Types

this is data type

Uploaded by

salman
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

C++ Data Types

this is data type

Uploaded by

salman
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Basic Data Types

Data Type Size Description

boolean 1 byte Stores true or false values

char 1 byte Stores a single character/letter/number, or ASCII values

int 2 or 4 bytes Stores whole numbers, without decimals

float 4 bytes Stores fractional numbers, containing one or more decimals. Sufficient for
storing 6-7 decimal digits

double 8 bytes Stores fractional numbers, containing one or more decimals. Sufficient for
storing 15 decimal digits
How to solve Square root in C++
#include <iostream>
#include <cmath>
using namespace std;

int main() {cout << "Square root of 25 = ";


cout << sqrt(25);
return 0;
}
How to solve Square in C++
#include<iostream>
#include <math.h>
using namespace std;
int main()
{ float E,m,c;
cout << "enter the value of mass in Kg=";
cin >> m;
cout << "enter the value of speed in m/s=";
cin >> c;
E=m*c*c;
cout << "the energy in J is =" << E;
return 0;
How to solve exponent in C++
#include <iostream>
#include <cmath>
using namespace std;
int main () {
long double base = 5.5;
int exponent = 6;
long double result1 = pow(base, exponent);
cout << result1 << endl;
return 0;
}

You might also like