C++ Comments and shows a few variables and their declarations.

Description

C++ Comments and shows a few variables and their declarations.

#include <iostream>
using namespace std;
int main()// w w  w.  ja  v a 2s . c o  m
{
   int i, j;    // These three lines declare four variables.
   char c;
   float x;
   i = 4;       // i and j are both assigned integer literals.
   j = i + 7;
   c = 'A';     // All character literals are enclosed in single quotations.
   x = 9.087;
   x = x * 4.5;
   cout << i << ", " << j << ", " << c << ", " << x << "\n";
   return 0;
}



PreviousNext

Related