C++ double type with declaration and initialization

Description

C++ double type with declaration and initialization

#include <iostream>
using namespace std;
int main()/*from w  w w  .  j  a va2 s .  c o  m*/
{
   double grade1 = 85.5;
   double grade2 = 97.0;
   double total, average;
   total = grade1 + grade2;
   average = total/2.0; // divide the total by 2.0
   cout << "The average grade is " << average << endl;
   return 0;
}



PreviousNext

Related