Wednesday, May 20, 2020

Data types in C++

  • Program :
#include <iostream>
using namespace std;

int main() {
  cout <<"\n----------------DATA TYPES----------------\n";
  // Creating variables
  int a = 5;             
  float b = 5.99;   
  double c = 9.98; 
  char d = 'D';       
  bool e = true;     
  string f = "Hello"; 
 
  // Print variable values
  cout << "int: " << a << "\n";
  cout << "float: " << b << "\n";
  cout << "double: " << c << "\n";
  cout << "char: " << d << "\n";
  cout << "bool: " << e << "\n";
  cout << "string: " << f << "\n";

  return 0;
}




  • Output :



No comments:

Post a Comment

Function Overloading in C++

https://monitechvenkat1620.blogspot.com Program : #include <iostream> using namespace std; int c(int x, int y) {   return...