Wednesday, May 20, 2020

Declaring variable using constant datatype in C++

  • Syntax :


     type variable = value;

  • Program :

#include <iostream>
using namespace std;

int main() {
  cout <<"\n----------------DECLARING VARIABLE----------------\n";
  //The value is constant it can not be changed
  const int minutesPerHour = 60;
  const float PI = 3.14;
  cout << minutesPerHour << "\n";
  cout << PI;
  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...